# Exclude the particular categories

**URL:** <https://talk.jekyllrb.com/t/exclude-the-particular-categories/638>\
**Category:** Help\
**Created:** [June 11, 2017, 11:24am UTC](https://talk.jekyllrb.com/t/exclude-the-particular-categories/638 "2017-06-11T11:24:35Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![yashumittal](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/yashumittal/32/1260_2.png) [@yashumittal](https://talk.jekyllrb.com/u/yashumittal)\
**Post date:** [June 11, 2017, 11:24am UTC](https://talk.jekyllrb.com/t/exclude-the-particular-categories/638/1 "2017-06-11T11:24:36Z")

</div>

Can we exclude the particular posts categories using `if` or `else` statement?

---

<div class="post-metadata">

**Author:** ![rdyar](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/rdyar/32/710_2.png) [@rdyar](https://talk.jekyllrb.com/u/rdyar)\
**Post date:** [June 11, 2017, 3:38pm UTC](https://talk.jekyllrb.com/t/exclude-the-particular-categories/638/2 "2017-06-11T15:38:31Z")

</div>

Not real clear what you mean.  
First google result for `jekyll exclude category`:

[http://jekyllsnippets.com/excluding-posts-by-category/](http://jekyllsnippets.com/excluding-posts-by-category/)

---

<div class="post-metadata">

**Author:** ![Rien](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/rien/32/34_2.png) [@Rien](https://talk.jekyllrb.com/u/Rien)\
**Post date:** [June 11, 2017, 5:21pm UTC](https://talk.jekyllrb.com/t/exclude-the-particular-categories/638/3 "2017-06-11T17:21:03Z")

</div>

Do you mean to exclude posts completely from the site? Or just in specific places.?

We can use if-else to filter specifically, that will work. So if you want to exclude a post somewhere based on the category, you can use that. But as a post may specify multiple categories you will probably need some array operations or a for-loop as well.

---

<div class="post-metadata">

**Author:** ![yashumittal](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/yashumittal/32/1260_2.png) [@yashumittal](https://talk.jekyllrb.com/u/yashumittal)\
**Post date:** [June 11, 2017, 6:31pm UTC](https://talk.jekyllrb.com/t/exclude-the-particular-categories/638/4 "2017-06-11T18:31:41Z")

</div>

For example:

**We have four different categories: A, B, C, D**

On the homepage we see the blog posts from all 4 categories and it get listes according to the date. Right?

I want that from that list of blog posts on homepage, it should not show the blog posts of D category.

Can that be possible?

---

<div class="post-metadata">

**Author:** ![Rien](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/rien/32/34_2.png) [@Rien](https://talk.jekyllrb.com/u/Rien)\
**Post date:** [June 11, 2017, 6:49pm UTC](https://talk.jekyllrb.com/t/exclude-the-particular-categories/638/5 "2017-06-11T18:49:57Z")

</div>

Yes, but you will have to modify the theme.

Somebody correct me if I am wrong, but I do not think that this is supported out of the box.

Are you using minima? (The default theme)?

---

<div class="post-metadata">

**Author:** ![yashumittal](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/yashumittal/32/1260_2.png) [@yashumittal](https://talk.jekyllrb.com/u/yashumittal)\
**Post date:** [June 11, 2017, 6:54pm UTC](https://talk.jekyllrb.com/t/exclude-the-particular-categories/638/6 "2017-06-11T18:54:02Z")

</div>

> [@Rien](#):
>
> Yes, but you will have to modify the theme.

I think you didn’t got my point. 😕

---

<div class="post-metadata">

**Author:** ![Rien](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/rien/32/34_2.png) [@Rien](https://talk.jekyllrb.com/u/Rien)\
**Post date:** [June 11, 2017, 7:03pm UTC](https://talk.jekyllrb.com/t/exclude-the-particular-categories/638/7 "2017-06-11T19:03:57Z")

</div>

Modifying a theme is not so difficult. But you do need some html/css and possibly programming experience.

---

<div class="post-metadata">

**Author:** ![ginfuru](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/ginfuru/32/773_2.png) [@ginfuru](https://talk.jekyllrb.com/u/ginfuru)\
**Post date:** [June 14, 2017, 1:48am UTC](https://talk.jekyllrb.com/t/exclude-the-particular-categories/638/8 "2017-06-14T01:48:53Z")

</div>

@yashumittal

you can use the snippet example that @rdyar provided just change out the operator  
`{% if post.category != "D" %}`
