Display Latest Post - Blog Folder Only - List - Edit Template

Beginner Alert 

I am editing an existing template and I am confused what I am doing wrong.

I want the latest post section of the webpage to only show post/content within the blog folder.

At the moment it shows all post no matter what folder they are in under the content folder.

Please review folder content below:

image

Below is the what the webpage looks like for latest post.

In my example it seems to be showing test.md which is at the bottom of the latest post section.

If possible I would like it to only show content below blog folder for example blog01.md, blog02.md, blog03.md.

Below is the template code where I think I have to edit.

I think I have to edit:

{{ range .Data.Pages }}

I am not sure but I also think I might have to look at list.html file to resolve my issue.

Any advice would be appreciated.

Below is part of the blog.html

I done a lot research but I currently not understanding the structure of how it linked.

So I thought I post a forum post for support just to hopefully point me in the right direction.

This is the template I have been working on for review : https://themes.gohugo.io/meghna-hugo/

Thanks for Reading this post.

Kind Regards,
Paulser

Hey there.

This blog.html, what is it ? A partial a template file ?

What is the structure of your layouts directory ?

Thanks.

As Regis mentioned, we need that info to really help ya.

But, just going off what you did provide, the below code would only show posts under the blog section

{{ range where .Data.Pages "Section" "blog" }}

Sorry yes I think it is a partial template file.

below us the structure of layout directory.

Link to blog.html code

Additional Information that might help thanks again for reviewing this.

PARTIALS

Link to blog.html

_DEFAULT

Link to list.html

Link to single.html

Link to baseof.html

Yep, so change this line in the blog partial https://github.com/themefisher/meghna-hugo/blob/master/layouts/partials/blog.html#L15

{{ range .Data.Pages }}

To this

{{ range where .Data.Pages "Section" "blog" }}

And that should do the trick.

Also, I recommend filing a GitHub issue against the theme, detailing the above. It’ll be a quick fix for the theme author.