11ty is a useful static site generator (SSG), and out of the box its easy to set it up with blog posts from your markdown (
These by default will create a URL by looking at the blog post title (and 'slugging' it).
If you want to customise your post url in 11ty (eleventy), then you can just add the
permalink config to your md files.
Two important notes to adding permalink in eleventy: you have to include a slash at the start and end (otherwise setting permalinks will just try and download a file instead of serving the blog post). And you should include the
So your md file might look like:
--- layout: post title: Some really long post name that you do not want as a slug excerpt: Something here date: 1999-01-01 updatedDate: 1999-01-01 draft: false permalink: /posts/short-name-here/ tags: - post --- your content here
The important line here to have a custom post url is the
permalink: /posts/something/ - and remember the slashes!
Note: remember to redirect your old urls to the new url. If you use netlify, see this guide on setting up redirects
Comments →Custom post urls in 11ty/eleventy (slug/permalink)