Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom permalinks for blog posts #193

Open
choldgraf opened this issue Jan 14, 2023 · 0 comments
Open

Custom permalinks for blog posts #193

choldgraf opened this issue Jan 14, 2023 · 0 comments

Comments

@choldgraf
Copy link
Contributor

choldgraf commented Jan 14, 2023

Describe the feature

Currently, ABlog uses the path to the source file for blog post permalinks, similar to any other Sphinx page. It is a common practice in the blogging world to instead have a user-defined permalink structure (e.g. /:year/:month/:day/:filename). This allows you to organize your local filesystem without requiring you to use the same URL link structure (e.g. many blogs are now only using the page title in the URL instead of adding date-based subfolders).

Proposed solution

ABlog could provide a configuration option like ablog_permalink_structure, which would take a string with a few keyword arguments that were supported. E.g.:

  • year
  • month
  • day
  • category
  • slug

And so the value could be something like:

# Month and year-based pages
ablog_permalink_structure = "{year}/{month}/{slug}"

# Just the slug
ablog_permalink_structure = "{slug}"

# Would error because the variable doesn't exist
ablog_permalink_structure = "{year}/{foo}/{slug}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants