0

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?

1 Answer 1

0

It's actually very simple.

Under the https://mfaani.com/posts/foo/ just add an empty _index.md file.

That will then add all your posts for that category.

Note:

It's good idea to add frontmatter to the _index.md page. Because if you've nested one directory in another, then it will use the _index.md of the subdirectory to know how to include the description of the subdirectory the list page.

For example if the _index.md is empty then you'll see:

enter image description here


Alternatively if you add the following frontmatter, then you'll see something like the following:

---
Title: '⚡️ SERIES -  Optimizing App Size'
---

A description of the post goes here. 

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.