Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make HTML behave exactly like other content formats #12008

Merged
merged 1 commit into from
Feb 7, 2024

Conversation

bep
Copy link
Member

@bep bep commented Feb 7, 2024

This currently only contains a test that illustrates the issue.

Without digging down trying to find the reason why this has changed, I think we agree that the current behaviour is less than useful, and that if we're going to break anything, we might as well break it in the direction of useful.

What if we say that we start treating all content files the same (Markdown, HTML, Asciidoc etc.).

Does that sound like a plan?

@bep bep force-pushed the fix/html-vs-resources-11999 branch from d20c183 to b38beec Compare February 7, 2024 17:08
@bep bep requested a review from jmooring February 7, 2024 18:39
@bep
Copy link
Member Author

bep commented Feb 7, 2024

@jmooring this should be a controlled change as I have just "removed lots of code". I have added some test cases, but it would be good if you could have a look.

@jmooring
Copy link
Member

jmooring commented Feb 7, 2024

Using this example...

git clone --single-branch -b hugo-github-issue-11999 https://github.com/jmooring/hugo-testing hugo-github-issue-11999
cd hugo-github-issue-11999
rm -rf public/ && hugo && tree public

This content...

content/
└── posts/
    └── post-1/
        ├── foo.jpg
        ├── index.md
        ├── with-front-matter.html
        ├── with-front-matter.md
        ├── without-front-matter-begins-with-<.html
        ├── without-front-matter-does-not-begin-with-<.html
        └── without-front-matter.md

Produces these results...

File Page resource Copied to pubic
foo.jpg ✔️ ✔️
with-front-matter.html
with-front-matter.md ✔️
without-front-matter-begins-with-<.html ✔️
without-front-matter-does-not-begin-with-<.html ✔️
without-front-matter.md ✔️

I think the second one should be a page resources to be consistent with how we handle the other content formats.

@bep bep changed the title Investigate HTML in content Make HTML behave exactly like other content formats Feb 7, 2024
@bep
Copy link
Member Author

bep commented Feb 7, 2024

├── with-front-matter.html
├── with-front-matter.md

I will have a look (but I do suspect you would see the same if you add with-front-matter.asciidoc etc. -- as in, the same base name).

@jmooring
Copy link
Member

jmooring commented Feb 7, 2024

When we have two images (non-content resources) with the same base name there is no collision; both are available as resources, and both are copied to public.

But when we have two content files (content resources) with the same base name, only one is available as a resource. Not sure which one wins.

@bep
Copy link
Member Author

bep commented Feb 7, 2024

I need to take that issue (which is not related to this particular issue) in #12013 -- we currently pick one of the versions (based on a consistent sort order), which makes sense for regular pages, possibly not for page resources ... but it's hard to distinguish the two at this point, so I suspect I need to print a warning about it -- I don't see why you would need two content files with the same name.

Other than that ... this is OK?

@jmooring
Copy link
Member

jmooring commented Feb 7, 2024

Other than that ... this is OK?

Yes!

@bep bep merged commit 676e687 into master Feb 7, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants