-
-
Notifications
You must be signed in to change notification settings - Fork 87
Enhancement: Date format in preview path #593
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
Comments
@svrooij, do you have a date field in your front matter section? The |
@estruyf yes I do have the date field in the front matter. I think it's even a default field if you setup front matter CMS. I was not sure if formatting would be an option, or if it would be easier to make 3 addition special placeholders |
Indeed, OOTB Front Matter has a date field, but you can adapt it by referring to your older articles. This |
Having the |
@svrooij I have added it. The format changed a bit. I've asked ChatGPT what would be the ideal field definition. It was pretty close to what we already came up with. The format for this will be: PS: Feel free to try it out in the |
It works perfectly, shall I close the issue? Or does that happen automatically if you release the new version |
@svrooij I will close it when I document and release it in the main version. |
Is your feature request related to a problem? Please describe.
I migrated from Jekyll to Hugo and wanted to keep the old url format
/{year}/{month}/{day}/{slug}
this is perfectly doable in Hugo. But now I cannot get the preview path to load, since it would require having the day.Describe the solution you'd like
I would like support for either
{{fm.day}}
/{{fm.month}}
/{{fm.year}}
in the preview path or have some sort of formatting option on the provided date value like{{fm.date.format('yy')}}
or{{fm.date:yy}}
depending on language features.Describe alternatives you've considered
I've considered using the
{{pathToken.x}}
placeholders, but that does not work because I don't have the day folder, since my posts are stored incontent/posts/{year}/{month}/{slug}.md
format.The text was updated successfully, but these errors were encountered: