Use filename as title when it's not defined in front matter


#1

Note: I’m new to Hugo, so If there’s a better way about this fell free to correct me.

For now I use {{.File.TranslationBaseName}} in template cause {{.Title}} is empty string. I thought it’s better to store it in the title variable, as themes out there are already using it. Also we could use file dates for date and lastmod.

I thought this is a nice feature especially when there’re a lot of content files imported from another system.

For myself, I use nvALT to take markdown notes. nvALT has already handle the title and date in this way, now I want to use Hugo for building the website. But maintaining notes metadata by hand is not a good practice IMHO.

What do you think?


#2

Sounds reasonable, but could you create an issue on GitHub?


#3

Sure, it’s here: https://github.com/gohugoio/hugo/issues/3805

Glad you say so :wink:


#4

this is related/similar to Default title to first header in content? which I got a working patch for.