Title to File to URL conversion

I just noticed that the URL Hugo creates from the title uses the case of the title. For example, title = "There and Back" will be created in public/post/There-and-Back/.

I have to go back through and convert my titles to all lowercase because the existing site had lowercase URLs. It’s not a lot of work, but it does make me wonder what the intended relationship between URL and Title and Filename and Slug should be.

BTW: It’s amazing the things you notice after going live :slight_smile:

I have the reverse problem.

from documentation https://gohugo.io/content/archetypes/

Hugo provides a simple archetype which sets the title (based on the file name) and the date in RFC 3339 format based on now(), which returns the current time.

hugo new post\2016-11-27_new_blog.md creates title = “2016 11 27_new_blog”.
I woud like to have title = “2016-11-27 new blog” or better title = “new blog”.
Can we get any regex to make it our way?

I had posted about this very recently. My solution is to use a wrapper bash script. I provide the title to the script, and the script in turn derives the file name as I want, calls hugo new using that, sets the specified title in the front matter, and opens the file in my $EDITOR. Hope it helps.

Hi,

I have read your post. I work with Windows, no bash on board.
Editing the generated title is not a problem, only a sugestion.

There is no way to give a filename and a title from prompt.

It would be nice to have 2 ways

  • generate title from filename (regex in archetypes?)

  • generate a filename like permalinks,
    hugo new post/my-post could generate post/2016-11-28_my_post.md

2nd, can Hugo add .md to the filename?

Thanks for your answer.