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

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.

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>
11 Likes

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

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

3 Likes

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?

Check this: It’s Time We Talked About Tags

2 Likes

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,

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

1 Like

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.

1 Like

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

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?

2 Likes

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?

1 Like

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.

2 Likes

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!

1 Like

No, it is not possible.

1 Like

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

4 Likes