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 « J'aime »

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 « J'aime »

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

1 « J'aime »

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 « J'aime »

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

1 « J'aime »

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 « J'aime »

Nice one! thanks @tshenry :heart:

1 « J'aime »

Y a-t-il une raison de ne pas combiner votre script avec le suivant dans Personnaliser → Thèmes → Mobile → En-tête ?

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

Cela assurera la redirection initiale vers /latest si l’utilisateur arrive sur la page d’accueil.

1 « J'aime »

Pas de raison particulière, non. Cela dit, je n’utilise plus ce script. Avec l’ajout de pages d’accueil sélectionnables par l’utilisateur, je laisse ceux qui préfèrent /latest la choisir.

1 « J'aime »

J’ai initialement trouvé ce sujet en cherchant une solution à mon problème :

Comme expliqué, j’ai configuré mon forum pour afficher les catégories + les derniers sujets, car je ne veux pas afficher uniquement les derniers sujets sur ordinateur. Voici les deux paramètres Discourse qui rendent cette mise en page possible :

C’est la mise en page idéale pour moi, car elle affiche à la fois les catégories pour les utilisateurs souhaitant publier quelque chose de nouveau, et les derniers sujets pour les autres personnes qui reviennent simplement voir ce qui est nouveau.

Pour toute personne qui lit ceci et souhaite faire la même chose, voici ce qu’il faut faire :

  1. Allez dans la section Modifier le CSS/HTML de votre thème :

  2. Ajoutez le script suivant dans la section MobileEn-tête (afin qu’il n’affecte que les visiteurs sur les appareils mobiles) :

    Voici le script pour que vous puissiez le copier/coller :

    <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>
    

Mise à jour : Le composant de thème Page d’accueil mobile forcée lié ci-dessus est probablement une meilleure façon d’accomplir cela.

10 « J'aime »

Serait-il possible d’ajouter cette fonctionnalité au niveau de chaque utilisateur ? Par exemple, permettre à chaque utilisateur de choisir sa page par défaut sur mobile dans ses préférences d’interface (il existe déjà une option générale, nous aurions seulement besoin d’une option spécifique au mobile).

3 « J'aime »

Je rencontre actuellement le même problème : sur ordinateur, je préfère la vue par catégories où le dernier sujet apparaît à droite. Sur mobile, la vue par catégories n’affiche que les catégories. Sur mobile, je préférerais avoir la vue des « derniers » changements de sujets.

Ce serait formidable d’avoir deux préférences :

  • page d’accueil par défaut sur ordinateur : [champ de sélection]
  • page d’accueil par défaut sur mobile : [champ de sélection]

Est-ce quelque chose pour lequel une PR serait acceptée ?

7 « J'aime »

Cela pourrait-il aussi être un paramètre par appareil ? Les solutions de contournement mentionnées ci-dessus ne sont pas idéales car elles imposent ce paramètre à tous les utilisateurs mobiles (et les tablettes sont difficiles à classer à cet égard). Il est également évident qu’il est souvent pertinent d’avoir des préférences différentes selon l’appareil, et pas seulement une distinction entre ordinateur de bureau et mobile.

1 « J'aime »

C’est la meilleure chose depuis la roue ! Merci mon frère

1 « J'aime »

J’aimerais aussi avoir ces préférences… Y a-t-il un moyen de le faire ?