I have a urls like this:
https://mfaani.com/posts/foo/bar
https://mfaani.com/posts/foo/baz
https://mfaani.com/posts/foo/qud
I want users to be able to see all my "foo" blog posts at the following URL:
https://mfaani.com/posts/foo or perhaps https://mfaani.com/foo
But that returns a 404.
Is there a way to achieve this?
It's actually very simple.
Under the
https://mfaani.com/posts/foo/just add an empty_index.mdfile.That will then add all your posts for that category.
Note:
It's good idea to add frontmatter to the
_index.mdpage. Because if you've nested one directory in another, then it will use the_index.mdof the subdirectory to know how to include the description of the subdirectory the list page.For example if the
_index.mdis empty then you'll see:Alternatively if you add the following frontmatter, then you'll see something like the following: