Different landing page for desktop vs mobile theme?

No worries. I should have linked to instructions here too! There is a nice illustrated set of instructions you can check out here. It’s possible you might be on the latest version of Discourse, in which case the UX for themes and components has changed a little. Let me know if the instructions I linked to still leave you a little lost. I’d be happy to help you figure it out.

By the way, the topic below is the home of this theme component now:

2 Me gusta

thanks @tshenry i’ll take a look.

however I’ve just fiddled round with the customization settings - I’ve never had an issue before, and now my site has disappeared!! Just produces a blank screen, but the code is there!!

any idea how to reverse changes from the cli???

cheers

You’ll need to go to your site’s safe mode Air Cadet Central and check “disable current theme” then you’ll want to revert whatever change you made in the customizations.

2 Me gusta

thanks fella - didn’t know that existed! Lifesaver!

1 me gusta

OK back up and working - thanks again - I’ve installed your theme and it’s installing as a Theme not a Theme Component??? any ideas. I’m on Version: v2.1.0.beta5 +66

cheers, and thanks for your hard work :smiley:

No problem. If you select it from the list of themes, then scroll down, you should see a section like this:

You’ll want to click the “make component” button then confirm. You should then be able to add it to your main theme the way it’s outlined in the instructions I linked to earlier.

Fab, getting there! Making it a component works, but when I add it to my theme it adds a component with the others but there’s no text for the link, but the (x) button is there. The link it produces ends in a # where the others don’t??
and it doesn’t seem to work!!

Cheers

Ah yeah, I think that might be a little bug that’s still getting worked out. Try refreshing the page, then click the (x) if that blank theme component is still there, then try selecting the Force Mobile Homepage component again. You might also try selecting another theme component from the dropdown list, then open the list again and select the Force Mobile Homepage component again. Click the “add” button and hopefully that should do it!

3 Me gusta

You are indeed a hero - now working as advertised! Many thanks for your help today, greatly appreciated!

1 me gusta

Yes, I’ve come across this several times. Has this been reported I wonder?

I don’t know - I haven’t - but @tshenry 's suggestion of moving in and out of the drop down menu after a page reload worked.

1 me gusta

Nice one! thanks @tshenry :heart:

1 me gusta

¿Hay alguna razón para no combinar tu script con el siguiente en Personalizar → Temas → Móvil → Encabezado?

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

Esto manejará la redirección inicial a /latest si el usuario llega a la página de inicio.

1 me gusta

No hay ninguna razón en particular, no. Dicho esto, ya no uso ese script. Con la adición de páginas de inicio seleccionables por el usuario, simplemente aquellos que prefieren /latest la seleccionan.

1 me gusta

Originalmente encontré este tema al buscar una solución para mi problema:

Como se explica allí, tengo mi foro configurado para mostrar categorías + últimos temas, ya que no quiero mostrar solo los últimos en escritorio. Estas son las dos configuraciones de Discourse que hacen posible ese diseño:

Es el diseño ideal para mí, ya que muestra las categorías para los usuarios que buscan publicar algo nuevo y también pone a disposición los últimos temas para quienes simplemente vuelven para ver qué hay de nuevo.

Para cualquiera que esté leyendo y quiera hacer lo mismo, esto es lo que debes hacer:

  1. Ve a la sección Editar CSS/HTML de tu tema:

  2. Agrega el siguiente script en la sección MóvilEncabezado (para que solo afecte a los visitantes en dispositivos móviles):

    Aquí está el script para que puedas copiarlo y pegarlo:

    <script>
        if (window.location.pathname == "/")
        {   window.location.href = "/latest";
        }
    </script>
    
    <script type="text/discourse-plugin" version="0.4">
        api.changeWidgetSetting('home-logo', 'href', '/latest')
    </script>
    

Actualización: El componente de tema Forced Mobile Homepage enlazado arriba probablemente sea una mejor manera de lograr esto.

10 Me gusta

¿Sería posible tener esta función por usuario? Es decir, que cada usuario pueda elegir su página predeterminada en móviles en las preferencias de su interfaz (ya existe una general allí, solo necesitaríamos una exclusiva para móviles).

3 Me gusta

Actualmente tengo el mismo problema: en el escritorio prefiero la vista de categorías donde el último tema aparece a la derecha. En el móvil, la vista de categorías solo muestra las categorías. En el móvil, preferiría tener la vista de “últimos” cambios en los temas.

Sería genial tener dos preferencias:

  • página de inicio predeterminada en escritorio: [campo de selección]
  • página de inicio predeterminada en móvil: [campo de selección]

¿Es esto algo para lo que se aceptaría una PR?

7 Me gusta

¿Podría tratarse también de una configuración por dispositivo? Las soluciones alternativas publicadas anteriormente no son ideales porque obligan a aplicar la configuración a todos los usuarios móviles (y en este sentido, es difícil clasificar las tabletas). Además, es bastante evidente que a menudo puede tener sentido tener preferencias diferentes según el dispositivo, no solo la distinción entre escritorio y móvil.

1 me gusta

¡Esto es lo mejor desde la invención de la rueda! Gracias, hermano.

1 me gusta

Me encantaría tener esas preferencias también… ¿Hay alguna forma de hacerlo?