How to render specific category into specific pages?

I am new to hugo, I have tried to use hugo in oct 2016, but I failed to learn how hugo actually works. Believe me I am trying to learn hugo from last two days, but it is still not easy for me as jekyll.

I have content folder like this

/content/folder/sub-folder/my-post.md

And my-post.md file contain frontmatter with category name helloworld

---
title:  "Hello World"
categories: 
- helloworld
---

Now I want to display list of post under that category(helloword) into /sub-folder/ permalink. How can I achieve that? I have tried using _index.md into /sub-folder/ but it does not render pages, instead it display the original codes. It will be great if you share you list.html layout and where to put range loop codes to display specific category.

I think you’re asking about NestedSections, i.e. rendering lists in sub folders. This is not currently available but it will be in the next Hugo release, whenever @bep implements it.

In the meantime if you want to learn more about list pages in Hugo read this: https://gohugo.io/templates/list

1 Like

This is probably the biggest thing when to learn Hugo. I come from Jekyll as well. Now I know that Hugo’s template system is by far more flexible than Jekyll’s. It all starts in the layouts/_default folder. You can render a whole site with just 2 templates: single.html and list.html. If you want your post in your sub-folder to render a specific template you can use the layout: key in Front Matter. The layout you reference to should be in layouts/folder/sub-folder just like your content. You should read the new docs - especially the templates part: Lookup Order.

Hope this helps

Thanks but I did not get how to render my list of categories into specific directory of my site (like /folder/sub-folder/). It is possible when I used categories taxonomies and it’s layout so the URL become site.com/categories/my-post/ or site.com/tags/my-post/, but I don’t want to include /categories/ or /tag/ into permalink.

I think @alexandros is right about that.