(due to very limited space I don’t recommend adding more than one link on mobiles)
Settings
Name
Description
custom header links
Custom links to be displayed in the header
links position
Note that when links are displayed on the left, they’re automatically hidden while scrolling within topics to make room for the title
Adding links is straightforward. Every link needs 6 items. You enter comma delimited values in this order:
link text, link title, URL, view, target, hide on scroll
Link text: the text for the link. Link title: the text that shows when the link is hovered. URL: The path for the link (can be relative). View: vdm = desktop and mobile, vdo = desktop only, vmo = mobile only. Target: blank = opens in a new tab, self = opens in the same tab. Hide on scroll: remove = hides the link when the title is expanded on topic pages keep = keeps the link visible even when the title is visible on topic pages.
If you’re not sure what hide on scroll does, here’s an example:
Most Liked and Privacy are set to keep and so they remain visible. The other links are set to remove, and so are hidden when the title expands in the header. This only affects topic pages.
Links position: This setting allows you to change the default layout so links will appear on the left near the logo instead of on the right. Note that when positioned to the left, links will automatically be hidden when scrolling within topics to make room for the topic title.
Hosted by us? Theme components are available to use on our Standard, Business, and Enterprise plans.
don’t know if this has been suggested, tried reading back but couldn’t find it.
was thinking that maybe adding the ability to create “sub-links” thus creating the idea of a list that you could edit (text color, background hover etc.) to get results similar to what zoom has
Is it possible to add some basic dropdown menu to an any item?
I couldn’t create a dropdown menu with “Custom header links”. It seems Zoom did that. I reviewed their dropdown menu via console, but I couldn’t figure out how they interfere with the html of this component for adding dropdown to any item.
Is there a way this theme component can allow for dropdown navigation? That means, when I hover over a header link, it has sub-items that appear underneath it. I know that this can be done via html/css as shown here:
Thank you for creating this component!
One question and potentially a feature request: can we show a specific link for a specific group?
For example, if a user is in group customers I’d like to show a link to the customer’s control panel, if a user is in group workers I’d like to add a link to a different panel.
I think this would be a very useful feature.
The group name could be the last (optional) parameter.
Obrigado por isso! Acabei de encontrá-lo depois de tentar vários outros banners e componentes. É exatamente o que eu preciso!
Uma solicitação/sugestão: capacidade de reordenar os links. Acabei de criar vários e percebi que gostaria de adicionar um no topo. Agora terei que copiar e colar manualmente todos eles, o que é bastante complicado, pois eles continuam sincronizando/atualizando outras entradas à medida que os copio para baixo.
Arrastar e soltar ou botões de subir/descer seriam muito úteis para futuros usuários (ou futuras edições).
@Nick_Chomey Muitas vezes me vi precisando fazer isso, não apenas para este componente de tema, mas para muitos outros componentes de tema que usam a configuração type: list. Eu estava planejando enviar uma solicitação de recurso antes, mas me esqueci completamente, mas como você me lembrou, adicionei uma aqui:
Este componente adiciona uma classe CSS a cada link com base em seu texto. A classe adicionada é a mesma do texto que você dá ao link, exceto que os espaços são substituídos por um hífen (-) e o texto é definido como minúsculo. Em seguida, a string -custom-header-links é anexada no final.
Portanto, se você adicionar um link com o texto
privacy
então o elemento do link terá a classe
privacy-custom-header-links
Se o texto do seu link for
Visit Shop
então a classe CSS seria
visit-shop-custom-header-links
Então, agora você sabe a classe adicionada a cada link. Voltando à sua pergunta.
O Discourse adiciona uma classe CSS à tag <HTML> quando o usuário não está logado. Essa classe é
anon
Portanto, você pode usá-la para ocultar certos links para usuários que não estão logados. Digamos que eu tenha um link com o texto
Customer Support
e eu não quero que ele apareça para usuários que não estão logados.
Observe que o display: none; do CSS apenas oculta o link da renderização do navegador, mas ele está sempre totalmente visível para quem visualiza o código-fonte da página, para rastreadores e mecanismos de busca.