-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Description
This isn't anything new. The behavior described below is present in v0.73.0 and later, and probably well before that. Anything we do here will be a breaking change, limited to those sites where path
is specified in one or more of its output format definitions.
Important
Since this change is going to break some eggs, I strongly suggest we address #4428 and #7497 at the same time.
Our documentation describes the output format path
setting as follows1:
The published file’s directory path, relative to the root of the publish directory. If not specified, the file will be published using its content path.
However, the actual behavior is very different.
Consider this site configuration:
uglyURLs = false
[outputFormats.print]
isPlainText = true
mediaType = 'text/plain'
path = 'print'
[outputs]
home = ['html','print']
page = ['html','print']
section = ['html','print']
taxonomy = ['html','print']
term = ['html','print']
[taxonomies]
tag = 'tags'
And this content structure:
content/
├── s1/
│ ├── _index.md
│ └── p1.md
├── tags/
│ ├── red/
│ │ └── _index.md
│ └── _index.md
└── _index.md
When you build the site, the URL pattern of the "print" output format depends on the page kind, which doesn't make sense:
page kind | content path | published path |
---|---|---|
page |
content/s1/p1.md |
public/print/s1/p1/index.txt |
section |
content/s1/_index.md |
public/s1/print/index.txt |
taxonomy |
content/tags/_index.md |
public/tags/print/index.txt |
term |
content/tags/red/_index.md |
public/tags/red/print/index.txt |
home |
content/_index.md |
public/print/index.txt |
Or to look at the entire structure:
tree
public/
├── print/
│ ├── s1/
│ │ └── p1/
│ │ └── index.txt
│ └── index.txt
├── s1/
│ ├── p1/
│ │ └── index.html
│ ├── print/
│ │ └── index.txt
│ └── index.html
├── tags/
│ ├── print/
│ │ └── index.txt
│ ├── red/
│ │ ├── print/
│ │ │ └── index.txt
│ │ └── index.html
│ └── index.html
└── index.html
My expectation is that the URL pattern would be the same2 regardless of page kind.
Test site that matches the above:
git clone --single-branch -b hugo-github-issue-13829 https://github.com/jmooring/hugo-testing hugo-github-issue-13829
cd hugo-github-issue-13829
rm -rf public/ && hugo && tree public
We need test cases with and without uglyURLs
enabled.
References:
- https://discourse.gohugo.io/t/custom-outputformat-path-and-index-md-files/55215
- https://discourse.gohugo.io/t/published-path-of-alternate-output-formats/35695/13
- Hugo with uglyURLs = true generates /public/section.html instead of /public/section/index.html #4428
- Output format with custom path on section pages - Image paths broken #7342
- resources/page: Fix custom output formats path for sections and taxonomies #7771
- Output format (AMP) prefix is getting put after sections and taxonomies #7159