How to default to latest on mobile and categories+latest on desktop?

(Tobias Eigen) #1

Is there a way to default the frontpage to display latest page on mobile, while on desktop displaying the categories+latest combined view? I’m currently trying to figure this out.

(Jeff Atwood) #2

No there is no way to do this.

Main view on pc and mobile
(Tobias Eigen) #3

Thanks. That’s a bit sad tho as I am finding it frustrating to have to take an extra step to find latest when on mobile and using the discourse app. It tells me I have new posts to read, I select the link and then see not topics but categories. On desktop I am ok with the cat+latest view which my colleagues prefer but on mobile it shows me just cat.

(Lutz Biermann) #4

You could do it, if you edit the nginx-settings. We use a nginx reverse proxy, so its no real problem. Its a dirty hack, but works.

    # ---------------------------------------------------------------------------------
    # Redirect Mobile to latest instead to default
    # ---------------------------------------------------------------------------------
        set $mobile_rewrite N;
        if ($http_user_agent ~* "(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino") {
               set $mobile_rewrite Y;
        if ( $http_referer !~* "www\.mydomain\.com" ) {
               set $mobile "${mobile_rewrite}E";
        if ($mobile_rewrite = YE) {
               rewrite     ^\/$ redirect;
        if ($http_user_agent ~* '(iPhone|iPod|android|blackberry)') {
             rewrite     ^\/$ permanent;

This version is shorter and faster, may also work for you. [code] if ($http_user_agent ~* "(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino") { rewrite ^\/$ redirect; } [/code]

Different landing page for desktop vs mobile theme?
Show Latest Posts on mobile view
(David Taylor) #5

The compromise we reached on our forum was to

  • Set categories as the homepage
  • On mobile, make the logo link to /latest

That way the categories view is welcoming to potentially new visitors, while regular users are just 1 tap away from the ‘latest’ page.

The suggestion came from somewhere on meta, but I can’t find it right now.

The code we use (in the Mobile “Header” section of CSS/HTML customisation) is

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

(on an unrelated note, can json uploads be enabled on meta, so we can share “exported” customisations for others to easily import?)

Front page (home page) layout design
Show Latest Posts on mobile view
Different between mobile display and website display
Set the top menu in the mobile view independently of the desktop view
Display categories on Desktop and Latest Post on mobile
(Steve Combs) #6

Definitely in favor of a admin setting for

  • mobile category page style

To go along with the current setting for

  • desktop category page style

Categories+Latest combined view is brilliant for desktop but Latest is key for mobile.

Set the top menu in the mobile view independently of the desktop view
(Vincent) #8

Bumping this feature request:

Mobile usage is more and more frequent on my community, and I too think the default mobile view is pretty unpleasant when using Categories + Latest as the category page style.

(Erlend Sogge Heggen) #9