Accessing post of a section at the base URL

Say I have a section called articles with a few posts (.md files) in it. I should be able to access the posts via http://localhost:1313/articles/<post>. Is there a way to access the post via http://localhost:1313/<post>? I tried adding the slug property in the front matter but does not work :frowning:

slug = “/data” # instead of the default articles/data. Also tried “data” without the slash. File is articles/

Try url = "data" instead.

1 Like

Thanks @Arif for finally giving me peace. :smiley:

Welcome. slug is the last part of a path while url is relative to the root. If you want to use slug, you can configure permalinks for the section in your config.toml file as follows

  articles = "/:slug/"
1 Like

Oh wow, I like this better. One stop solution since I already have tens of pages with slug in them.

Indeed it is. Cheers!

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.