Have custom folder name without affecting the URLs

Hi,

I’d like to have my folder names independent of the route / URL. The reason for this is say, you have a menu structure displayed as:

  1. Introduction
  2. Getting started
  3. Others

and then your directory inside the content folder is ordered by name as:

  • getting-started
  • introduction
  • others

This becomes hard when you have a lot of folders. Hence I would like to prefix my folders with numbers the same as in the menu so it becomes easy to find and order them. So something like this:

01.introduction
02.getting-started
03.others

I tried this, but all my urls get prefixed with the numbers like this: http://localhost:1313/02.getting-started

How can I have my folders named independent of my URLs?

Thanks in advance

You want to look for url in the frontmatter. Create your folders, then add in each file’s frontmatter something like

url: /introduction/chapter-title

This will override the automatic link title. Depending on your needs slug might help. If you have for instance a _index.md file in the folder 01.introduction you could add slug: introduction there and subsequent files in that structure will use introduction in the url. But it might be too specific for you.

1 Like

Thanks for your reply. The url frontmatter worked for me. Appreciate your help.

I think there is also slug: your-url-here as well, which maybe useful to you.

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