I’m attempting to add a custom link to the navbar (Ideally something where I’d be able to specify a name and a relative URL for that pill to go to). It’s similar functionality to the ‘bugs’ or ‘features’ links on meta, but I want them to go to a plugin-defined route (/lattices/:id), rather than a category-related route.
This doesn’t appear possible with the ‘top menu’ user setting, because it doesn’t accept a custom URL
I had a dig and found the ‘extraNavItem’ custom html field, which seems like it would do what I want:
{{#each navItems as |navItem|}}
{{navigation-item content=navItem filterMode=filterMode}}
{{/each}}
{{custom-html "extraNavItem"}}
But that {{custom-html}} tag seems inaccessible, at least from the Admin > Customize > CSS/HTML customizations, and even if I were to manually save a model myself, there’s no database column for extra_nav_item_baked in site_customizaation.rb, which is where I assume that outlet would read from.
@gdpelican, would you mind sharing your solution? I was looking at the extra-nav-item plugin outlet but have not had much luck yet (very new to Discourse here). My next step is the JS approach you linked to.
Thanks, the example is helpful (I’m not kidding when I said I was very new!)
I see what you are saying about getting this to look nice – the custom_html is defaulting to inserting a <div> when it needs to be a <li> for that particular location (nav items). For example, when I do:
<ul id="ember950" class="ember-view nav nav-pills">
<li id="ember963" title="topics with recent posts" class="ember-view active"><a href="/latest">Latest</a></li>
<li id="ember965" title="topics created in the last few days" class="ember-view"><a href="/new">New (1)</a></li>
<li id="ember967" title="topics you are currently watching or tracking with unread posts" class="ember-view has-icon"><a href="/unread"><span class="unread"></span>Unread</a></li>
<li id="ember969" title="the most active topics in the last year, month, week or day" class="ember-view"><a href="/top">Top</a></li>
<li id="ember971" title="all topics grouped by category" class="ember-view"><a href="/categories">Categories</a></li>
<div id="ember972" class="ember-view"><a href="/faq">Faq</a></div>
<!----></ul>
where the last item is the one added via custom_html. I’ve tried several variations and the <div> seems to be a given.
However: the navigation-bar.js does contain an actual declared plugin outlet (see the last line):
I’ve experimented with creating a connector for the extra-nav-item outlet as in Part 2 of the relevant tutorial, but it doesn’t appear to be getting picked up right now. If anyone has good examples of this outlet in use, I’d appreciate them.
(My fallback is the JS method linked above, but I’d prefer to avoid it.)