Link personalizzati di navigazione superiore

Thanks for the additional detail! It was indeed some fragile CSS. We have class names here where there formerly were none, so we can be more specific now.

I’ve refactored the component a bit here:

So all it will need is an update.

I’ve updated this so hide default links will hide all the default links, not just latest & categories. I think this will make the hide behavior a little easier to understand.

Nav items added by this component will now get a nav-item_custom_item-name class, where item-name is the display name of the nav item (spaces replaced with hyphens). So a nav item named “my bookmarks” can be targeted with CSS like this:

#navigation-bar {
   li.nav-item_custom_my-bookmarks {
     background: skyblue; 
   }
}

Default items have a class name like nav-item_name, so if you want to hide the default categories link you can do:

#navigation-bar {
   li.nav-item_categories {
     display: none;
   }
}

This should get the active class now.

3 Mi Piace

Hi,

The latest update changes the nav link display text to lowercase and adds extra dashes.

We have the following in the nav link field:

⮉ Home;show all categories;/forums

The nav link shows up as follows:
image

Previously it was showed as: ⮉ Home

This line appears to be the culprit:

2 Mi Piace

thanks for mentioning it, I just made a minor update that fixes this!

3 Mi Piace

Given that we’re in wildest dream territory here—thank you so much for these fixes @awesomerobot!—a useful addition to this component would be an option to make the custom nav appear before the category and tag dropdowns, is that possible (without loads of work)?!

1 Mi Piace

You can do this with some CSS added to a theme:

.desktop-view {
  #navigation-bar {
    order: -1;
    margin-right: 0;
  }
  .category-breadcrumb {
    margin-right: auto;
  }
}
3 Mi Piace

That looks like magic.

Hello,
How can i setup URL in Nav canbe open in new tab?
Thank you!

This is not possible from the plugin, you need to add custom javascript for this.

1 Mi Piace

Hello Guys,

Is there a way to display the link on mobile please?

Thanks!

Hi there, are you referring to the full links instead of the dropdown on mobile?
If so, there isn’t much space on mobile to have the links. The dropdown compacts it as one.

Hi,

Thank you for your quick reply!

Sorry I should have played more with the settings it does not appear on mobile because I have checked Hide the default links on both mobile and desktop.

How can I hide these default links and still display my links on mobile please?

I’ve put in a bug report for this TC:

This really quite ruins the functionality; if it isn’t going to be addressed, perhaps this should be tagged broken?

4 Mi Piace

Suggestion: include icons as an option. I used emojis and it looks really stylish, but it breaks on mobile and obviously isn’t consistent

There is a component which allows you to add icons to the links in the top navigation: Discourse Nav Item Icon / Emoji
and it also works with custom links added by this component. The only difference is that you need to add custom_ in front of the name of the nav item.

For example,
I added a “Preferences” link with the help of this component: Preferences;edit your preferences;/my/preferences

And then I configured the icon/emoji component to add the wrench icon: icon:custom_preferences:solid:wrench:currentColor

Result:
image

1 Mi Piace