# Same posts in home page and category pages

**URL:** <https://discourse.gohugo.io/t/same-posts-in-home-page-and-category-pages/43521>\
**Category:** support\
**Created:** [March 19, 2023, 3:40pm UTC](https://discourse.gohugo.io/t/same-posts-in-home-page-and-category-pages/43521 "2023-03-19T15:40:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ansin218](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ansin218/32/6991_2.png) [@ansin218](https://discourse.gohugo.io/u/ansin218)\
**Post date:** [March 19, 2023, 3:40pm UTC](https://discourse.gohugo.io/t/same-posts-in-home-page-and-category-pages/43521/1 "2023-03-19T15:40:02Z")

</div>

I went from Hugo v0.42 to v0.101.0 for my blog and had quite a few things break in my theme, functionalities, etc. While I managed to fix many things, this is one of the things I still couldn’t do.

I get the same list of posts on my home page and my other category pages based on folders (programming, recipes, travel).

```auto
{{ $paginator := .Paginate (where .Site.Pages.ByDate.Reverse "Type" "in" (slice "post" "programming" "travelogue" "recipes")) }}
{{ range $paginator.Pages }}

```

I managed to round down the problem to these lines in the `post-list.html` file but all my experiments failed. I either get category pages with relevant posts and the home page just merely listing out the categories, or I get the home page and category pages listing out all posts and not having it separated / relevant.

Here’s the link to my blog: [https://www.ankuroh.com/](https://www.ankuroh.com/)  
The theme I had been using: [https://github.com/eueung/hugo-casper-two](https://github.com/eueung/hugo-casper-two)

Can someone please help me here? Thanks!

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [March 19, 2023, 4:20pm UTC](https://discourse.gohugo.io/t/same-posts-in-home-page-and-category-pages/43521/2 "2023-03-19T16:20:59Z")

</div>

First, `themes/duck-hugo/layouts/_default/terms.html` is never used. If you want a unique template for term pages, you need to rename this to `themes/duck-hugo/layouts/_default/term.html`.

Second, you are calling the same partial for _all_ of your list pages:

```auto
{{ partial "post-list" . }}

```

And it always uses the same page collection.

It is doing what you are telling it to do.

---

<div class="post-metadata">

**Author:** ![ansin218](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ansin218/32/6991_2.png) [@ansin218](https://discourse.gohugo.io/u/ansin218)\
**Post date:** [March 19, 2023, 4:50pm UTC](https://discourse.gohugo.io/t/same-posts-in-home-page-and-category-pages/43521/3 "2023-03-19T16:50:16Z")

</div>

Thanks for the response @jmooring!

Yes, I understand that it is doing what it has been asked to do. However, the line worked fine when I was operating in v0.42; so I am still struggling with how to go about the changes.

If this logic makes sense, I can think of having an if-else condition that says if it’s a home page, then display everything, else, display section/type specific posts. I managed to get the if part and the else part but separately. What would be the if-else condition to detect if the page is a home/landing page, could you please help me with this?

As for your other suggestion, I renamed it to `term.html`, although had no idea what this was doing. Just read about it from the documentation but still struggling with where else to call this file because you said it is not being used anywhere.

Thanks for the help so far nevertheless!

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [March 19, 2023, 4:55pm UTC](https://discourse.gohugo.io/t/same-posts-in-home-page-and-category-pages/43521/4 "2023-03-19T16:55:43Z")

</div>

Evaluate `.Kind` in your conditional.

---

<div class="post-metadata">

**Author:** ![ansin218](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ansin218/32/6991_2.png) [@ansin218](https://discourse.gohugo.io/u/ansin218)\
**Post date:** [March 19, 2023, 5:42pm UTC](https://discourse.gohugo.io/t/same-posts-in-home-page-and-category-pages/43521/5 "2023-03-19T17:42:50Z")

</div>

Thanks a lot @jmooring

For anyone else stumbling upon this page; the solution would be something like this:

```auto
{{ if eq .Kind "home" }}
.....whatever you want to do as per the home page......
{{ else }}
......something else you want to do on other pages.....
{{ end }}

```

Alternatively, you can also do it section-wise:  
`{{ if eq .Section "whatever-is-your-section" }}`

Another way, both my `index.html` and `list.html` were calling `post-list.html` file.

You can also create a `home-post-list.html` file that caters to `index.html` whereas the `post-list.html` file caters to `list.html` (sections for example).

Reference to Page Kinds:  
[https://gohugo.io/templates/section-templates/#page-kinds](https://gohugo.io/templates/section-templates/#page-kinds)

Other references:  
[https://discourse.gohugo.io/t/how-to-check-for-home-page/149/25?u=ansin218](https://discourse.gohugo.io/t/how-to-check-for-home-page/149/25)
