HUGO

Section specific config.toml settings

How do I set UglyURLs = "true" only for a specific section?

This is a global setting, therefore it is not possible to use it for selected pages.

1 Like

OK, thanks. Too bad. I don’t think .html is ugly per se and “pretty” URLs may make sense when there’s additional content in the directory (like images) in i.e. a leaf bundle for a post. If it’s a single contact.html in the root of the site, I don’t think a pretty url makes sense.

Is there another way of making URLs only in the posts/ section nice while keeping the rest of the site ugly?

URL management is global. You can override manually by setting the url parameter in each content file’s front matter.

There is no other way as far as I know.

config.toml

uglyURLs = true

[outputFormats.pretty]
  isHTML = true
  mediaType = 'text/html'
  noUgly = true
  permalinkable = true
  rel = 'canonical'

[[cascade]]
  outputs = ['pretty']
  [cascade._target]
    path = '/posts/**'
3 Likes

Thanks for the voodoo @jmooring! It works, but I’m not sure how. :grinning:

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