Skip to content

Use filename as title when it’s not defined in front matter #3805

@idealhack

Description

@idealhack

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?

This was originally posted at https://discourse.gohugo.io/t/use-filename-as-title-when-its-not-defined-in-front-matter/7965

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions