What i expect is this print.aspx to be called datasource.aspx and located under the print path. (dist/learn/design-system/docs/datasource.aspx)
This seems to happen with all _index.md pages.
This is incorrect: https://gohugo.io/configuration/output-formats/#path. It explains what should happen (I think), not what’s actually happening. The path is relative to the current section for sections, else it’s relative to the root of the publish directory. And the base name is wrong. And this happens whether or not uglyURLs is enabled. I tested as far back as v0.100.0 and saw the same thing… this isn’t anything new.
This has come up several times in the past. For example:
Yeah, I think your conclusions are correct. This is a messy problem, and the desired behavior is debatable. Whatever we do will be a breaking change.
I assume your use case is something like:
User visits page
User clicks link to the “printable” version
Use prints the “printable” version
In that scenario, the actual location of the printable version is irrelevant, meaning that the printable version can be adjacent to the web version, or in its own unique path relative to the site root. Does that sound right to you?
I ask because, if we do something about this, we need to pick one or the other.
Yes, that sounds quite right, the main benefit of having the site in a separate folder was it sounded easier to do: post processing, crawling, hide from search, feed to an LLM, ignore from navigation, hide from sitemap, etc.
Now that I think about it… it might be a lot of work!!! But I guess i’ll have to do that either way.
Another idea is to have a separate environment / project / build script where I will only build this site version, and then publish it on a different site, and fabricate the “print link” manually on the main site.
Which is why I didn’t suggest it (trading one problem for another).
Another thought is to use a different extension for the print media type, removing the need for the path setting in the output format definition. Perhaps the print version doesn’t need to be dynamic, and you could use “html”. Or use “html” and configure the server to interpret as aspx. Or something.
Thank you for your advices! I think I’ll go ahead and continue, with the separate environment/project route.
I do believe the path + uglyURL setting is somehow bugged, I can open a new issue if you like, but I believe this is being tracked already. Let me know.