# View only category

**URL:** <https://meta.discourse.org/t/view-only-category/60626>\
**Category:** Feature\
**Created:** [April 8, 2017, 1:59am UTC](https://meta.discourse.org/t/view-only-category/60626 "2017-04-08T01:59:19Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![vinothkannans](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vinothkannans/32/86465_2.png) [@vinothkannans](https://meta.discourse.org/u/vinothkannans)\
**Post date:** [April 8, 2017, 10:19am UTC](https://meta.discourse.org/t/view-only-category/60626/10 "2017-04-08T10:19:46Z")

</div>

I don’t have exact solution for you. But I have good work around. Put the below code in `admin/customize/body` page.

```plaintext
<script>
var TopicTrackingState = require('discourse/models/topic-tracking-state').default;
function addCategories(model) {
    
    var categories = [
            { id: 200, name: "First Private Category", url: "/groups/my-group-page", color: "79a", description_excerpt: "hi, this is description" },
            { id: 201, name: "Second Private Category", url: "/groups/my-group-2", color: "f9a", description_excerpt: "hi, this is description" }
        ];
        
    categories.forEach( function(item, index) {
        item.read_restricted = true;
        item.topicTrackingState = TopicTrackingState.create({});
        
       var category = Discourse.Category.create(item); 
       
        if (!Discourse.Site.currentProp('categoriesById')[category.id]) {
            if (model) {
                model.categories.addObject(category);   
            } else {
                Discourse.Site.currentProp('categories').addObject(category);
            }
        }
    });
    
}
Ember.run.later( function () {
    addCategories(); 
}, 1000);

var DiscoveryCategoriesRoute = require('discourse/routes/discovery-categories').default;
DiscoveryCategoriesRoute.reopen({
    afterModel(model) {
        addCategories(model);
    }
});
</script>

```

In above code you can add all private categories which you want to showcase by putting it in each lines like below

```plaintext
{ id: 200, name: "First Private Category", url: "/groups/my-group-page", color: "79a", description_excerpt: "hi, this is description" },
{ id: 201, name: "Second Private Category", url: "/groups/my-group-2", color: "f9a", description_excerpt: "hi, this is description" }

```

Here `id` must match to the original category id and you should put relevant group’s url in the `url` field.

---

_[View the full topic](https://meta.discourse.org/t/view-only-category/60626)._
