Custom Homepage for Groups

I just merged it, so give it a try.

Thanks, @nathank!

2 Likes

Great, it works! This is SO much better than trying to figure out all the right default user groups :slight_smile:

Thanks!

2 Likes

Hello!! This is awesome, thank you so much for this plugin :grin:

There is just one observation on my part, which I’m unsure if it’s unintended behaviour: on the mobile, once a custom homepage has been set, if I want to click the forum logo to get back to the traditional homepage, it just brings me back to the custom homepage. If this behaviour is intended, could it be optional? (if not, can I change it on my side somehow?)

Thank you again for this great tool!! :slight_smile:


Update: I was able to overcome this by using the Custom Header Links component, by setting one header link to bring me back to the full original homepage (the gopuram icon was visually fit for this). This opens another possibility: now that we can set an icon to inequivocally bring users to the full standard homepage, could now the forum icon lead to the custom homepage the user sees from desktop? It would be very practical when using the phone (and by default in desktop).

Update 2: if I set a homepage for a determined group, it overrides the mobile homepage setting, can this be prevented?

You are most welcome - it certainly comes in handy for some use-cases!

Yeah, that is quite tricky to change reliably. I thought about it a while ago and gave up.

Glad you found a workable solution!

The ‘Everything’ link on the sidebar should also do the same thing, or if you want something more specific you can use a custom sidebar section too.

Yes, that is designed behaviour, as I assumed that if you were taking the trouble to redirect a group to a specific homepage then it should also apply on mobile.

But if that is no good for you, you could add

  1. a setting to say if mobile is overriden or not (not too hard)
  2. have it specify it on each group/homepage, but would take quite a major rejig to achieve that

Do feel free to do a PR! Or commission a dev to have a crack at it.

3 Likes

Hello, You can achieve it like this :arrow_down_small:

It will override the logo url to /latest.

<script type="text/discourse-plugin" version="1.3.0">
  api.changeWidgetSetting('home-logo', 'href', '/latest')
</script>
3 Likes

Thank you once again @Don for your fast support, and @nathank for your input :slight_smile:
The strong support of this community has been all in this path I have been pursuing 2 years now… :')

Both your inputs made me realize of a strategy to solve this apparent sphinx riddle. So I finally got it sorted out this way:

Objective:

  • In desktop, send a user to a custom homepage as per his group.
  • Have the forum icon linking to the categories page.
  • Have a custom header “home” icon linking to the custom homepage.
  • Have the same on mobile, except that the first homepage be the chat room.

Steps:

  1. Disable “force homepage on mobile” in the “Custom Homepage” plugin, and leave only the homepage per group options active.
  2. Change Logo link to redirect to full forum via (thanks @Don!):
  <script type="text/discourse-plugin" version="1.3.0">
   api.changeWidgetSetting('home-logo', 'href', '/categories')
  </script>
  1. Make new header icon link to redirect to custom homepage (use plain forum URL for this effect).

  2. Use this handler in the case the user is on mobile:

  <script>
   if (window.location.pathname == "/")
   { window.location.href = "/chat";
   }
  </script>

This is nice in that a user can change his preference for a custom home that will be obeyed both on desktop and mobile (via the new header icon). I’m forcing chat as homepage for mobile because I assume that it will be the most recurring use-case there.

And thats it! it works like a charm :grin:
Thanks to all of you once again :pray:

2 Likes

Hi, I want to set a category page as default for everybody, and I’m very excited to see that a community theme component exists that does exactly that. Thank you so much!

The forum where I will apply this change is almost two years old and chances are that some users will complain and prefer to have the current homepage (plain Latest). As far as I can see, users won’t be able to define their preferences, is this correct?

If they can’t, one idea that comes to mind is to create an “Old Homepage Fans” group :wink: that users can join, and set Latest for users of this group.

Just checking whether this approach makes sense before I make such disruptive change on the forum. :slight_smile:

2 Likes

Yes, that is correct.

With more dev work it might be possible to utilise / expand the exisiting user setting in that way, but not at the moment.

Your workaround sounds smart and should work nicely. The key is ensuring that the group is configured to be primary for those users.

Good luck!

3 Likes

Homepage Feature seems to work only for the official Discourse homepages, not for the custom ones this theme component supports. It’s a pity to lose those nice pictures on the homepage…

It would be great if Homepage Feature and Custom Homepage would be compatible, and I’m not sure where is the right place to ask, here, there, or in both places. :slight_smile:

The key is probably a change on Homepage Feature, so that you can specify any Discourse page to display the featured posts. You then would get this TC to point to the page you specified.

@awesomerobot - what do you think?

Hey, I want my homepage to start with the welcome search banner that i installed followed by the categories summary followed by a redditish preview feed of highlighted subjects. I don’t really understand the “group page map” setting in this theme and am wondering if it can fulfill my needs.
Thanks for your time

This component does not change how things look. It changes where users will go when they go to the site home (like by clicking the home icon).

The group map is to allow different groups to get a different default page on the site.

I think you might want Showcased Categories

@afscstagiaire are you looking for something akin to this?

1 Like

yes exactly !

2 posts were split to a new topic: Best practices for using Licensed code?

Unfortunately this seems to have broken with the latest core changes.

Hopefully @pfaffman or I can look into it soon.

1 Like

Is there a way to automate the homepage settings so i don’t need to type them in manually? I’m allowing some users to create their own categories and their homepage should automatically be set to the category they created.

Merefields plugin used to do this when a group was added to only one category’s permissions it would become their homepage, but the app wouldn’t build with that plugin so i think its not running on the latest discourse.

What’s the issue? Could it be this bug (that’s been fixed)?

Edit: oh yes. Something has changed. I wasn’t able in 5 minutes to see how to fix it. Hopefully I’ll have more time very soon.

Edit: I think it might be fixed. It’s important not to have a leading slash on the path.

1 Like

I"m removing broken from this, as I think it’s fixed.

3 Likes

We’ve got another issue which I don’t understand at all I’m afraid.

This is for the TC with nothing turned on at all:

Screenshot 2023-12-09 14.08.10