Hi there! Moving from Jekyll to Hugo. Since I don’t have the published date and permalink in the frontmatter and adding that per post would be tedious work, is there:
a way to have Hugo detect the first part of the file name as the publish date e.g. 2021-03-05; and
define the file name after the date as the permalink e.g 2021-03-05-i-like-pizza.md and the permalink becomes /i-like-pizza/?
or alternatively, have the first part added to the front matter as date:?
@jhvanderschee the URL uses post title rather than the file name when I use your code. For example, if my post title is “How to Migrate from Jekyll to Hugo” and the URL is 2021-03-05-jekyll-to-hugo.md, I would like to retain the /jekyll-to-hugo/ as the URL. I stumbled upon this but it does not indicate how to get the slug part as well.
@jhvanderschee the URL uses post title rather than the file name when I use your code. For example, if my post title is “How to Migrate from Jekyll to Hugo” and the URL is 2021-03-05-jekyll-to-hugo.md , I would like to retain the /jekyll-to-hugo/ as the URL. I stumbled upon this but it does not indicate how to get the slug part as well.
I reproduced your problem and found in the docs that I should have used :slug instead of :filename. This works:
frontmatter:
date:
- :filename
- date
permalinks:
posts: /blog/:slug