How to create a "tag" button on the top bar?


(Fellowship Forums) #1

I’m looking to create a tag button on the top bar on the homepage that will go to a page similar to this:

https://what.thedailywtf.com/tags

How do I create this?

Thanks in advance for anyone willing to help.


(cpradio) #2

Add this to your customization under </body>

<script>
    var NavItem = require("discourse/models/nav-item").default;
    var ExternalNavItem = NavItem.extend({
        href : function() {
            return this.get('href');
        }.property('href')
    });
    
    I18n.translations.en.js.filters.tags = { title: "Tags", help: "View all Tags" };
    NavItem.reopenClass({
        buildList : function(category, args) {
          var list = this._super(category, args);
          list.push(ExternalNavItem.create({href: '/tags', name: 'tags'}));
          return list;
        }
    });
</script>

(Fellowship Forums) #3

I’ve added this code, but nothing is showing up on my top bar.

My next thoughts was maybe I needed to enable this from the Settings, so I go to Settings>top menu and I try to search up “tags” but nothing appears.

Thoughts?

My forum: www.fellowshipforums.com


(Fellowship Forums) #4


(Daniela) #5

The <script> </script> tag must also be copied.


(Fellowship Forums) #6

Thanks @Dax

Does anyone have any useful links/sources on the functionality of tags? I am pretty new to Discourse and would like to incorporate Tags on my page, but don’t know the range of possibilities for Tags. Any good Discourse Forum examples? Or Tags guidelines?


(Jay Pfaffman) #7

Check this: It’s Time We Talked About Tags


(Fellowship Forums) #8

Awesome, thanks for the link!

Is it possible to have “tag categories”? For example, we set up 4 or 5 tag categories (ex/ Exam topic, Syllabus material) and then users can create there own tags and assign them to the appropriate parent category so that in the “tag page”, users can see all of the tags related to a specific parent category?

Please let me know if this makes sense,


(Jay Pfaffman) #9

Did you read the blog post? It talks about tag groups, which seems to be what you’re talking about.


(Fellowship Forums) #10

Yes I did. I also read the example of a tag schema.

But in these examples, it looks like you need to have pre-made tags for each group, and users can choose which tags apply to which groups.

I’m looking to have pre-made “parent tags”, and allow users to come up with their own tags, and specify which parent tag they belong to.


(Fellowship Forums) #11

Also has there been any development on making the Tags Homepage look a bit nice/cleaner than the following - it looks pretty bland:

https://meta.discourse.org/tags

(Joe) #12

There are CSS classes readily available that would allow you to customize that page and its element to your liking. Did you have something specific in mind?


(Fellowship Forums) #13

Nothing specific in mind. Just want to see the range of possibilities and see what designs are out there. Where can I go to see example of these CSS classes for tags?


(Joe) #14

There’s a ton of possibilities

I am not aware of any pre-made customization for that particular page but if you have a mockups or examples you can post them here and I can try to help.


(Fellowship Forums) #15

Thank you very much!

I have drawn out a picture/description of what we are looking to create. It is posted at the bottom of this thread: Tag intersections page

One additional question I have though, is it possible to add spaces to the tags? Such as in Tags - What the Daily WTF?

Please let me know your thoughts, I very much appreciate your feedback!


(cpradio) #16

No, it is not possible.


(Joe) #17

Thanks for the very detailed mock up. I understand what you’re after.

Implementing the changes is far above what I know how to do. :sunflower:

There are a lot of experienced freelance developers on the forum. If you have a budget, I suggest creating a post in the #marketplace category.

Sorry I cannot be of more help