# How to add a new tab with content from a group?

**URL:** https://meta.discourse.org/t/how-to-add-a-new-tab-with-content-from-a-group/17278
**Category:** Development
**Created:** [06.Июль.2014 18:39:02 UTC](https://meta.discourse.org/t/how-to-add-a-new-tab-with-content-from-a-group/17278 "2014-07-06T18:39:02Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![DavidGNavas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/davidgnavas/32/68313_2.png) [@DavidGNavas](https://meta.discourse.org/u/DavidGNavas)
#### Post date: [06.Июль.2014 18:39:02 UTC](https://meta.discourse.org/t/how-to-add-a-new-tab-with-content-from-a-group/17278/1 "2014-07-06T18:39:02Z")

</div>

Continuing the discussion from [Please visit our Discourse Forum! (Directory)](https://meta.discourse.org/t/please-visit-our-discourse-forum-directory/3102/147):

> [@Please visit our Discourse Forum! (Directory)](https://meta.discourse.org/t/please-visit-our-discourse-forum-directory/3102/147):
>
> **Hitman forum**  
> Is the community for fans of the ‘Hitman’ series of video games.  
> We’ve been around for a decade (since the first game) and switched from a classic forum (IPB) to discourse.
> 
> On an unrelated note -I also did some CSS customisation, but nothing drastic.
> 
> [http://www.hitmanforum.com](http://www.hitmanforum.com)

Hi, @ampburner, your forum looks fantastic 😄

I haven’t found any `how-to` post that explains how to add a tab like the one you have added, called `IOI Tracker` and showing the content from a specific group.

Can someone explain how to do that?  
Thanks!

---

<div class="post-metadata">

### Author: ![ampburner](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ampburner/32/5103_2.png) [@ampburner](https://meta.discourse.org/u/ampburner)
#### Post date: [06.Июль.2014 19:31:47 UTC](https://meta.discourse.org/t/how-to-add-a-new-tab-with-content-from-a-group/17278/2 "2014-07-06T19:31:47Z")

</div>

Thanks 😄

Disclaimer - I’m sure my solution is kinda hacky. There might be better solutions.

Basically, what I did was add some javascript to the page HEAD by adding a script under Admin \> Customize \> CSS, HTML \> Header.

The script hooks into some of Discourse’s javascript events to manipulate the DOM and insert some html.  
The advantage of this approach is that it can all be done through the admin panel so you don’t need to install plugins or fork the Discourse source code.

that said, here’s the source code:

```
<script>
Discourse.Route.reopen({
        activate: function() {
            this._super();
            Em.run.next(function(){
                insertIOITrackerConditionally();
            });
        } 
    });

function insertIOITrackerConditionally()
{
    if(jQuery("#ioi-tracker-li").length <= 0){
        jQuery('ul.nav :last').after('<li id="ioi-tracker-li" class="ember-view" title="track the activity of IOI employees on Hitmanforum"><a href="/groups/iointeractive">IOI Tracker</a></li>'); 
    }
//some other stuff here to format the page (if you're on the actual group page)    
    
}
</script>

```

the hack was inspired by [https://talk.turtlerockstudios.com](https://talk.turtlerockstudios.com)

Just insert it in the admin panel and you’re good to go.

Could you recategorize this thread under how-to? I’m sure others might have the same question.

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [06.Июль.2014 19:55:50 UTC](https://meta.discourse.org/t/how-to-add-a-new-tab-with-content-from-a-group/17278/3 "2014-07-06T19:55:50Z")

</div>

Re-categorized. One down side to your approach is it requires JavaScript to be enabled (which isn’t a big deal) and search-engines won’t be able to find that additional tab for crawling (I’m not sure how well groups are handled by search-engines to begin with).

---

<div class="post-metadata">

### Author: ![ampburner](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ampburner/32/5103_2.png) [@ampburner](https://meta.discourse.org/u/ampburner)
#### Post date: [06.Июль.2014 20:15:43 UTC](https://meta.discourse.org/t/how-to-add-a-new-tab-with-content-from-a-group/17278/4 "2014-07-06T20:15:43Z")

</div>

My forum is a video game related fan-forum which is also frequented by the developers of the videogame.

The function of the tab is to allow the fans to keep track of the activity of the developers.

I’m not that worried about SEO of those particular pages (the important content is in the topics), but I would imagine that Discourse has built-in ways to make sure that the group pages are also crawled and indexed.

---

<div class="post-metadata">

### Author: ![DavidGNavas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/davidgnavas/32/68313_2.png) [@DavidGNavas](https://meta.discourse.org/u/DavidGNavas)
#### Post date: [07.Июль.2014 08:50:00 UTC](https://meta.discourse.org/t/how-to-add-a-new-tab-with-content-from-a-group/17278/5 "2014-07-07T08:50:00Z")

</div>

Thank you very much for share your code!

I think we will use to add a tab with an specific category 😄

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [08.Июль.2014 02:09:24 UTC](https://meta.discourse.org/t/how-to-add-a-new-tab-with-content-from-a-group/17278/6 "2014-07-08T02:09:24Z")

</div>

The topnav dev group link on [talk.turtlerockstudios.com](http://talk.turtlerockstudios.com) is a tiny plugin @eviltrout wrote, did we open source that Robin?

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [11.Июль.2014 04:03:51 UTC](https://meta.discourse.org/t/how-to-add-a-new-tab-with-content-from-a-group/17278/7 "2014-07-11T04:03:51Z")

</div>

Sure did!

[https://github.com/discourse/discourse-dev-nav-item](https://github.com/discourse/discourse-dev-nav-item)
