How do I range over only one specific directory?

Here is my source code repository:

My content directory structure is like this:
about/index.md
blog/first-post.md
blog/second-post.md
contact/contact.md

This is what I want:

I can’t type out full URL since apparently new users are limited to 2 URL in posts so I’ll try to explain without a full URL…

I want the site index ‘/’, i.e., the root/home page to be the actual index of blog posts. It will also have a header with the about and contact pages, but I don’t need any sort of range for that as there are only two so it is simple enough to manually put them in there.

Anyway, I want the blog posts in content/blog/* to listed on the home page ‘/’. I would assume that means I need a range in mytheme/layout/index.html, correct?

When I do so it just lists one posts, “blog”, which is the directory itself and obviously not what I intended. And then when the link blog is clicked it gives a 404.

I’m trying to get the root page/index to range through the blog posts, and even better would be to get it to do that and retain the /blog/first-post and /blog/second-post, etc. in the URL as oppossed to just /first-post, /second-post, etc…

I’ve been playing with this for a few months, reading the documents, searching the forums, and I haven’t been successful in implementing something that works yet. Any help would be GREATLY appreciated.

mytheme/layout/index.html

{{ range where .Site.RegularPages "Type" "blog" }}
2 Likes

Thank you so much! This is perfect!