Skip to content

Conversation

@blackb1rd
Copy link

@blackb1rd blackb1rd commented Oct 4, 2020

Fixes #7159
Fixes #7342

Before this fix

custom output formats path = amp

/{section}/amp/
/{taxonomy}/amp/
/en/{section}/amp/
/en/{taxonomy}/amp/
/th/{section}/amp/
/th/{taxonomy}/amp/

custom output formats path = htmlcontent

/{section}/htmlcontent/
/{taxonomy}/htmlcontent/
/en/{section}/htmlcontent/
/en/{taxonomy}/htmlcontent/
/th/{section}/htmlcontent/
/th/{taxonomy}/htmlcontent/

After this fix

custom output formats path = amp

/amp/{section}/
/amp/{taxonomy}/
/en/amp/{section}/
/en/amp/{taxonomy}/
/th/amp/{section}/
/th/amp/{taxonomy}/

custom output formats path = htmlcontent

/htmlcontent/{section}/
/htmlcontent/{taxonomy}/
/en/htmlcontent/{section}/
/en/htmlcontent/{taxonomy}/
/th/htmlcontent/{section}/
/th/htmlcontent/{taxonomy}/

Repoduce : https://github.com/jronallo/outputformats-path-issue

@bep
Copy link
Member

bep commented Oct 4, 2020

I'm a little surprised there were no test break, but I think you need to argue why

/en/amp/{section}/

Is more correct than:

/en/{section}/amp

Note that the current implementation is, if I remember correctly, deliberate. So, for a given page/section/whatever, add /amp to the path to get to the AMP version.

@blackb1rd
Copy link
Author

blackb1rd commented Oct 4, 2020

I'm a little surprised there were no test break,

it seems there is no testing about the AMP page path expectation for section,taxonomy,term. 😂 and AMP Format is the only one that provide the

d.Type.Path

So, I would expect it does not break any tests.

but I think you need to argue why
/en/amp/{section}/

Is more correct than:

/en/{section}/amp
Note that the current implementation is, if I remember correctly, deliberate. So, for a given page/section/whatever, add /amp to the path to get to the AMP version.

Ummm, I'm not so sure which one is correct. but for me, if keeping one folder for AMP version then it would be easier for debugging.
But the current version(0.75.1) behavior is mixing as below:

/en/{section,taxonomy,term}/amp/
/en/amp/{page}/

So I would like to avoid mixing as below:

/en/amp/{page,section,taxonomy,term}/

Note: This issue related to #5760, then /en/amp/{section}/ would be the correct one.

@blackb1rd
Copy link
Author

blackb1rd commented Oct 4, 2020

the second commit, I have added test case section,taxonomy,term for amp page and cleanup for long line.

@blackb1rd
Copy link
Author

blackb1rd commented Oct 11, 2020

This PR is ready, @bep if you have any comment let me know.

This also fix #7342 as User config

[outputFormats]
  [outputFormats.AppFormat]
    name = "app"
    isPlainText = false
    mediaType = "text/html"
    isHTML = true
    permalinkable = true
    path = "app"

[outputs]
  section = ["HTML", "APP"]
  page = ["HTML", "APP"]

User config define path

path = "app"

Before this fix

/{section}/app/
/{taxonomy}/app/
/en/{section}/app/
/en/{taxonomy}/app/
/th/{section}/app/
/th/{taxonomy}/app/

After this fix

/app/{section}/
/app/{taxonomy}/
/en/app/{section}/
/en/app/{taxonomy}/
/th/app/{section}/
/th/app/{taxonomy}/

without this fix, it lead User to confuse about what is actual Custom output path as comment in #7342

I've created a repository with the minimum required to demonstrate the problem.

https://github.com/maxwedwards/hugo_issue_7342

Browse to /blog and see a working image
Browse to /blog/app and see that the image is broken
Browse to /blog/post1 and see that the image is working
Browse to app/blog/post2 and see that the image is working

Note that the image is available at: /app/blog/grapefruit.jpg but the index.html is at /blog/app.

Hope I'm explaining myself.

The actual Custom output path shall be /app/blog/ instead of /blog/app.

see the original comment: #7342 (comment)

@blackb1rd
Copy link
Author

I belive this fixed, will never be merged, so anyone want this fix, I have forked this project to https://github.com/neohugo/neohugo.

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

2 participants