强制移动首页

Currently the default homepage settings found in the admin panel and user preferences apply to both desktop and mobile. This is a very simple theme component that will allow you to specify a different default homepage for the mobile view of your Discourse forum.

It is important to note that this will force mobile to navigate to the homepage you choose in this theme component. Your users will not be able to override the default homepage for mobile via their user preferences at this point.

Repository Link
https://github.com/tshenry/discourse-force-mobile-homepage

I don’t know if there’s anything to gain by including screenshots or putting a demo on theme-creator, but if anyone thinks otherwise, please speak up!

Theme Settings

There is one setting that allows you to set the mobile homepage as:

  • latest (default)
  • categories
  • new
  • unread
  • top

Installation

If you are new to installing theme components, check out @Johani’s excellent guide on theme components, particularly how to import a theme component and how to add the theme component to your main theme.

Future

  • Allow users to override the default we set in this component.

That’s it! Questions, comments, and suggestions are always welcome :slight_smile:

56 个赞

Works like a charm. This is great mate!

4 个赞

Great little component, just what I needed for my community!

Many thanks.

1 个赞

Can you please integrate this into core settings.

Sitewide default in settings for mobile and desktop.

And user setting in user profile settings for mobile and desktop.

:wink:

9 个赞

+1 for having different home page capabilities for mobile and desktop in core.

10 个赞

Thank you for this useful component.
Could you please help? While showing “Latest” by default on mobile, there is no option to choose “Categories” in top drop-down menu above topic list.

Exactly what I was after - thank you for this little component!

3 个赞

outstanding, thank you :pray::pray::pray::pray:

1 个赞

Thanks for creating this! :handshake: How about future compatibility as the main Discourse app continues to evolve and is updated? Or is the theme component pretty future-friendly in that regard?

2 个赞

This Theme component is super-simple and pretty much bomb proof I reckon! Just a couple of lines of CSS and HTML with no settings or anything fancy.

3 个赞

I still feel this should be merged into core as an additional setting, it is so utterly useful!

10 个赞

A great and simple little component.

Of course the requests immediately started from our power users that they be allowed to set their own override preference.

This serves the vast vast majority of normal users, but there is still demand for the ability to personally override by the top 1% of power users.

Agreed. It has not been updated in 7 years but still being used by Discourse owners.

1 个赞

1 个赞

Hope for an update

This is one of the must-have plugins that needs to be updated!:folded_hands:

I’ve updated it in a PR here: DEV: update to initializer by awesomerobot · Pull Request #3 · tshenry/discourse-force-mobile-homepage · GitHub

@tshenry can you take a look and merge when you have a chance?

6 个赞

Merged! Thanks for the PR!

6 个赞