Force Mobile Homepage

:information_source: Summary Force a different homepage for users visiting the site from a small viewport (e.g. mobile)
:eyeglasses: Preview Theme Creator
:hammer_and_wrench: Repository GitHub - tshenry/discourse-force-mobile-homepage · GitHub
:question: Install Guide How to install a theme or theme component
:open_book: New to Discourse Themes? Beginner’s guide to using Discourse Themes

Install this theme component

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 small viewport version of your Discourse forum.

It is important to note that this will force anyone using a small viewport to navigate to the homepage you choose with this theme component. Your users will not be able to override the default homepage for the small viewport context via their user preferences at this point.

Theme Settings

There is one setting that will allow you to set the alternative homepage to one of the following:

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

Potential future work ideas

  • Allow users to override the default set via this component.
57 Likes

Works like a charm. This is great mate!

4 Likes

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

Many thanks.

1 Like

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 Likes

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

10 Likes

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 Likes

outstanding, thank you :folded_hands::folded_hands::folded_hands::folded_hands:

1 Like

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 Likes

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 Likes

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

11 Likes

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 Like

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?

7 Likes

Merged! Thanks for the PR!

8 Likes

I got a deprecation notice for this great theme component in the developer console of the browser:

[THEME 50 ‘Force Mobile Homepage’] Deprecation notice: Accessing site.mobileView or site.desktopView during the site initialization can lead to errors and inconsistencies when the browser window is resized. Please move these checks to a component, transformer, or API callback that executes during page rendering. [deprecated since Discourse 3.5.0.beta9-dev] [deprecation id: discourse.static-viewport-initialization] [info: Designing for Different Devices (Viewport Size, Touch/Hover, etc.)]

2 Likes

Yes same thing, one of the only depreciation notice left for me…

1 Like

This is another victim of the change to capabilities.

What’s the new best way to load a specific discovery route as homepage depending on device type?

6 Likes

What @merefield said :neutral_face:

2 Likes