Skip to content

Instantly share code, notes, and snippets.

@DerSaidin
Created July 22, 2022 06:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DerSaidin/2abb8d40ff5ff27e57afa30d07a43eb3 to your computer and use it in GitHub Desktop.
Save DerSaidin/2abb8d40ff5ff27e57afa30d07a43eb3 to your computer and use it in GitHub Desktop.
Zola Proposal: Config option to keep dates in slugs

Pages like content/2022-07-21_topic/index.md or content/2022-07-21_topic.md have the date removed, so zola will choose the slug: topic.

For some blogs, the date is a key part of the page title, and this behavior leads to entries with the same slug.

I would like to have a config option to disable this behavior. Others have asked for this previously.

With this option, pages like content/2022-07-21_topic/index.md or content/2022-07-21_topic.md would keep their date, so zola would choose the slug: 2022-07-21-topic.

The main code to change for this is here.

The configuration will also need changes to pass in the option.

  • Questions: What should the config option be called?
    • slug_keep_dates (default false)
    • slug_strip_dates (default true)

Finally, the user documentation needs to be updated with this change.

I intend to work on this, and send a pull request. Any feedback on this plan is welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment