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 curtidas

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 curtidas

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

1 curtida

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 curtidas

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

1 curtida

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 curtida

Nice one! thanks @tshenry :heart:

1 curtida

Há algum motivo para não combinar seu script com o seguinte em Personalizar → Temas → Mobile → Cabeçalho?

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

Isso lidará com o redirecionamento inicial para /latest se o usuário chegar na página inicial.

1 curtida

Não há um motivo específico, não. Dito isso, eu não uso mais esse script. Com a adição de páginas iniciais selecionáveis pelo usuário, eu só tenho aqueles que preferem /latest selecionando-a.

1 curtida

Originalmente, encontrei este tópico ao procurar uma solução para o meu problema:

Como explicado, configurei meu fórum para exibir categorias + últimas postagens, pois não quero mostrar apenas as últimas no desktop. Aqui estão as duas configurações do Discourse que tornam esse layout possível:

Esse é o layout ideal para mim, pois exibe as categorias para usuários que desejam criar algo novo e também disponibiliza as últimas postagens para quem está retornando para ver o que há de novo.

Para quem está lendo e deseja fazer o mesmo, aqui está o que você precisa fazer:

  1. Vá até a seção Editar CSS/HTML do seu tema:

  2. Adicione o seguinte script na seção MobileCabeçalho (para que afete apenas visitantes em dispositivos móveis):

    Aqui está o script para você copiar e colar:

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

Atualização: O componente de tema Página Inicial Forçada para Mobile vinculado acima provavelmente é uma maneira melhor de realizar isso.

10 curtidas

Seria possível ter esse recurso por usuário? Ou seja, cada usuário poder escolher sua página padrão no mobile nas preferências de interface (já existe uma geral lá, precisaríamos apenas de uma específica para mobile).

3 curtidas

Estou com o mesmo problema: no desktop, prefiro a visualização de categorias, onde o tópico mais recente aparece à direita. No mobile, a visualização de categorias mostra apenas as categorias. No mobile, eu preferiria a visualização de “últimas” alterações de tópicos.

Seria ótimo ter duas preferências:

  • página inicial padrão no desktop: [campo de seleção]
  • página inicial padrão no mobile: [campo de seleção]

Isso é algo para o qual um PR seria aceito?

7 curtidas

Será que isso também poderia ser uma configuração por dispositivo? As soluções alternativas publicadas acima não são ideais porque forçam a configuração em todos os usuários móveis (e tablets são difíceis de classificar nesse aspecto). E é bastante óbvio que muitas vezes pode fazer sentido ter preferências diferentes baseadas no dispositivo, não apenas na distinção entre desktop e móvel.

1 curtida

esta é a melhor coisa depois da roda! Obrigado irmão

1 curtida

Eu adoraria ter essas preferências também… Existe alguma maneira de fazer isso?