Navigation - Add custom menu items


(Vinoth Kannan) #1

discourse-navigation


About

Plugin to add a custom menu items / nav links to your Discourse website automatically (without any coding / programming tweaks).

Supported Menus

List of currently available locations where the custom menu links can be added.

Screenshots


See it in action

Installation

Repo is at: GitHub - vinkashq/discourse-navigation: Plugin to add a custom nav menu links.

In your app.yml add:

hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - mkdir -p plugins
          - git clone https://github.com/discourse/docker_manager.git
          - git clone https://github.com/vinkas0/discourse-navigation.git

And then rebuild the container:

./launcher rebuild app

Configuration

You can easily add your custom menu links in /admin/plugins/navigation path.


Branding - Custom brand header with logo, navigation and icons
What's the simplest way to add a new navigation menu item?
Allowing Admins to place arbitrary links in topnav
Question on header/menu
How can I see in the topics list topics where I have participated?
Events Plugin :calendar:
The future of HTML/CSS customisations
Inconsistent tag selection when viewing tag pages
(STiNGER) #3

I installed your plugin but I do not see the configured link appear.
Not in the main navigation menu, nor in the hamburger general links or footer links.
I followed your instructions to the letter.
It there something I am missing?
I am running v1.7.beta11.


(STiNGER) #4

UPDATE: it needed a browser refresh. I see the configured link now in the general link and footer link sections of the hamburger menu. What can I do to make the link appear in the main menu?


(Vinoth Kannan) #5

To see main menu changes you should restart your app using ssh command below

./launcher restart app

In rare case if your main menu still didn’t appear. do rebuild

./launcher rebuild app

(STiNGER) #7

Thanks, I’ll try that!

Yep, the
./launcher restart app
did it.

Thanks!


(Matt Landseadel) #8

I had to rebuild app to make an entry show in Main menu. Even then, it showed as an unstyled link just beneath “Latest”. Isn’t it supposed to be styled and to the right of “Categories”?

Discourse Version v1.8.0.beta2 +72

I took a look at the created HTML.

<ul id="ember912" class="nav nav-pills ember-view">
  <li title="topics with recent posts" id="ember925" class="active ember-view"><a href="/latest">Latest</a></li>
  <li title="topics created in the last few days" id="ember927" class="ember-view"><a href="/new">New</a></li>
  <li title="topics you are currently watching or tracking with unread posts" id="ember929" class="has-icon ember-view"><a href="/unread"><span class="unread"></span>Unread (3)</a></li>
  <li title="the most active topics in the last year, month, week or day" id="ember931" class="ember-view"><a href="/top">Top</a></li>
  <li title="all topics grouped by category" id="ember933" class="ember-view"><a href="/categories">Categories</a></li>
<div id="ember934" class="ember-view"><li><a href="http://www.test.com">Test</a></li>
</div>
<span id="ember935" class="ember-view"><!----></span>
</ul>

Seems the ember934 should just be a li instead of a div.


(Chris Beach) #9

Is this plugin now functioning correctly and will it be actively maintained? I’d really like to use it but have been burnt before by unofficial plugins :frowning:


(Marc Billow) #10
<ul id="ember904" class="nav nav-pills ember-view">
  <li title="topics with recent posts" id="ember917" class="active ember-view">
    <a href="/latest">Latest</a>
  </li>
  <li title="all topics grouped by category" id="ember919" class="ember-view">
    <a href="/categories">Categories</a>
  </li>
  <li id="ember920" class="ember-view">
    <li>
      <a href="https://www.test.com">Test Link</a>
    </li>
  </li>
</ul>

You will notice the redundant list item <li> tag around the added link. This is what is causing it to be rendered without the correct style. I just submitted a PR on the repo fixing this issue.

It is a pretty simple plugin, so it doesn’t require that much development in it’s current form. My change was just merged so you should be all set to use it.


(Christoph) #11

I just tried installing both the navigation and the branding plugin but got the following error in the error log:

Error: There is no route named adminPlugins.navigation
    at k.handlersFor (https://forum.example.com/assets/ember_jquery-60dedd1dca1d8b8ce48b6d0087db3b96f3149b9b5af2d0c7c6357967d29031fb.js:18:30361)
    at n.applyToState (https://forum.example.com/assets/ember_jquery-60dedd1dca1d8b8ce48b6d0087db3b96f3149b9b5af2d0c7c6357967d29031fb.js:19:16847)
    at T.applyIntent (https://forum.example.com/assets/ember_jquery-60dedd1dca1d8b8ce48b6d0087db3b96f3149b9b5af2d0c7c6357967d29031fb.js:19:21581)
    at y (https://forum.example.com/assets/ember_jquery-60dedd1dca1d8b8ce48b6d0087db3b96f3149b9b5af2d0c7c6357967d29031fb.js:10:1640)
    at i._prepareQueryParams (https://forum.example.com/assets/ember_jquery-60dedd1dca1d8b8ce48b6d0087db3b96f3149b9b5af2d0c7c6357967d29031fb.js:10:11013)
    at i.normalizeQueryParams (https://forum.example.com/assets/ember_jquery-60dedd1dca1d8b8ce48b6d0087db3b96f3149b9b5af2d0c7c6357967d29031fb.js:9:16427)
    at i.generateURL (https://forum.example.com/assets/ember_jquery-60dedd1dca1d8b8ce48b6d0087db3b96f3149b9b5af2d0c7c6357967d29031fb.js:9:16551)
    at i.<anonymous> (https://forum.example.com/assets/ember_jquery-60dedd1dca1d8b8ce48b6d0087db3b96f3149b9b5af2d0c7c6357967d29031fb.js:5:13203)
    at c.h.get (https://forum.example.com/assets/ember_jquery-60dedd1dca1d8b8ce48b6d0087db3b96f3149b9b5af2d0c7c6357967d29031fb.js:7:24416)
    at Object.r [as get] (https://forum.example.com/assets/ember_jquery-60dedd1dca1d8b8ce48b6d0087db3b96f3149b9b5af2d0c7c6357967d29031fb.js:8:30431)
    at t.compute (https://forum.example.com/assets/ember_jquery-60dedd1dca1d8b8ce48b6d0087db3b96f3149b9b5af2d0c7c6357967d29031fb.js:7:8156)

Visually, I noticed that there was a lot of white space in the navigation bar and the plugin page did not display properly (no plugins listed). When I uninstalled the two plugins, it worked again…


How to disable a plugin when admin plugin page is not loading
(Joe Buhlig) #12

@vinothkannans, I haven’t tested this but this might be due to a missing / for path in your ember route map. I’ve had better luck spelling it out that way.


(Raddah ) #15

same with me


#16

@vinothkannans Hi! How to remove shortcuts? I disable the plugin, removed it form yaml file, rebuild whole container, and shortcuts in main menu are still there. How to get rid of them?


(Vinoth Kannan) #17

It must be removed now. Are you using brand header plugin?


(Clay Heaton) #18

@vinothkannans I just added the navigation plugin to a new rebuild of Discourse. The links will show up in the hamburger menu, but they do not appear in the main menu. Is there a problem with the plugin or anything else that I need to do to get them to appear there? In particular, I’m trying to add a main menu link called Tags that links to /tags.

Here are the settings. I hard-refreshed, etc.

Edit: Nevermind… I had to ./launcher restart app again to get it to appear.