Individual filenames for output formats

Hey everyone,

I’m looking for a way to have the output format (in my case ical) named as the individual post. For example, blog.com/my-birthday-party.ics instead of blog.com/my-birthday-party/index.ics. I think this might be usefull for the user as nobody wants generic index.ics files in their download folders.

In the documentation I could only find:

[outputFormats]
[outputFormats.Calendar]
baseName = 'event'

But this would only rename it to blog.com/my-birthday-party/event.ics.

I have created the file single.ics under /events and also added outputs: ["HTML", "Calendar"] to each event.

Hopefully, that has not already been discussed here, as I couldn’t find anything related.
Thanks so much!

https://gohugo.io/templates/output-formats#configure-output-formats

noUgly
used to turn off ugly URLs If uglyURLs is set to true in your site. Default: false.

And, per:
https://gohugo.io/templates/output-formats#output-format-definitions

The defaut noUgly setting for the Calendar output formal is also false.

So we need to enable uglyURLs in the site configuration, and then disable it for the HTML output format:

config.toml

uglyURLs = true
[outputFormats.HTML]
noUgly = true
1 Like

Thank you very much for you answer. I was searching with other terms and did not expect it to be named uglyURLs.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.