Don't want to show content/pages on the homepage!

Hello, I have 4 sections in the content folder

  • post
  • page
  • knowledge-base
  • news
  • reviews

I want all the posts to show on homepage except the pages in page folder. Guide me for that. Also, suggest me if i want to put that page folder in data folder and access the page from the link.


{{ range where .Site.RegularPages "Type" "ne" "page" }}


The data folder is where you can store additional data for Hugo to use when generating your site. Data files aren’t used to generate standalone pages; rather, they’re meant to be supplemental to content files.

Can I use this with

{{ $paginator := .Paginate (where .Data.Pages.ByDate.Reverse "Type" "ne" "page") }}
{{ range $paginator.Pages }}

Please try it, see what happens, and post again if there’s something you don’t understand.

Tried it, and it has no effect

When you’re ranging through pages on your home page, you typically want to range through all regular pages. See:

So, in your example, I would do this:

{{ $paginator := .Paginate (where .Site.RegularPages.ByDate.Reverse "Type" "ne" "page") }}
{{ range $paginator.Pages }}

If you continue to have problems, please post a link to the public repository for your site. See:

Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.

If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.

{{ $paginator := .Paginate (.Data.Pages.ByDate.Reverse) }}
{{range where $paginator.Pages "Type" "ne" "page" }}

Tried This and It Worked! Thank You!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.