Displaying all post with type: "post" as posts

Hi,

I have an issue with my settings,

currently the posts listing of my blog only show posts from /content/posts/

even if i set the type: “post”
when i create a .md in /content/misc, it will not be listed in the posts listing

I’m using the GitHub - 526avijitgupta/gokarna: A minimal opinionated theme for Hugo theme,

i’m not really sure where to look to fix this

If your content is in content/posts the .Type is posts (plural).
If your content is in content/post the .Type is post (singular).

1 Like

Is this happening on the homepage? And do you have type: posts set in the front matter of every post? Then copy this file from inside your theme to the main ./layouts folder in Hugo then change this line at the end from “post” to “posts”. If you don’t have the post type set in your front matter, then change the whole code to something like {{ $posts := .Site.RegularPages }}.

Or use a front matter cascade of type: posts.

in fact i just want to be able to save my posts in anywhere in /content/
not just in /content/posts/ ; example /content/topic1/post.md

because if i don’t put them in /content/posts/ they are not listed in this page: http://localhost:4419/posts/ but they appear in the tag section

using type: “post” is working as index.html in the layout uses:
{{ $posts := where .Site.Pages “Params.type” “post” }}

You say it is not working.

Now you say it is working.

Which is it?

As @jmooring mentioned above, the type corresponds to the section, hence you cannot expect any other posts outside ./content/posts to appear in that section. So, what do you really want? (if you go to your link and add topic1 at the end, you will see your posts there! Also, try the front matter cascade option coz that’s what I use on my site)

i understand it better now, thanks! sorry for the confusion

What was the solution?

You should share your solution in case someone else comes across this post. (I should clarify that the front matter cascade option I recommended is if you want to show all posts inside content somewhere, e.g on homepage or related posts). The other option is to group posts in their different sections that you can link to in your menu and other areas.

I don’t have a solution. I understand that I was sort of trying to reinvent the wheel,
your advices made me understand the structure of Hugo a bit better,
so i’ll for now use the defaut settings, and read about the front matter cascade part to understand it better, and maybe try to work on it later.