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

Page resources missing when language variant is draft #12105

Closed
nibe opened this issue Feb 21, 2024 · 4 comments · Fixed by #12117
Closed

Page resources missing when language variant is draft #12105

nibe opened this issue Feb 21, 2024 · 4 comments · Fixed by #12117

Comments

@nibe
Copy link

nibe commented Feb 21, 2024

When you have different language variants of a page (say example/index.md and example/index.de.md) and one of them is a draft, .Resources.Get and .Resources.GetMatch return nil for any resources.

In Hugo 0.122.0 it worked fine. Here's a minimal, reproducible example. Just unpack it and run hugo.
quickstart.zip

What version of Hugo are you using (hugo version)?

$ hugo version
hugo v0.123.1-3f8434a62fc91a50f4e5bd43a4435d2d301844ff+extended darwin/arm64 BuildDate=2024-02-21T08:17:45Z VendorInfo=brew

Does this issue reproduce with the latest release?

Yes.

@bep bep changed the title Regression: Page resources missing when language variant is draft Page resources missing when language variant is draft Feb 21, 2024
@bep bep added NotSure and removed NeedsTriage labels Feb 21, 2024
@bep bep added this to the v0.124.0 milestone Feb 21, 2024
@bep bep removed the NotSure label Feb 21, 2024
@bep bep self-assigned this Feb 21, 2024
@bep bep modified the milestones: v0.124.0, v0.123.2 Feb 21, 2024
@bep
Copy link
Member

bep commented Feb 21, 2024

I will test this, but one of the changes in v0.123.0 is that we don't duplicate resources (except in some cases) per language, so one resource file is attached to one language. That also means that if you draft the owning header, that resource also goes away. Does this match what you're seeing?

@nibe
Copy link
Author

nibe commented Feb 21, 2024

That sounds good. But when I draft example/index.de.md then cover.jpg goes missing for example/index.md. So I cannot draft translations of published articles without breaking my build.

@jmooring
Copy link
Member

I can confirm the problem. Drafting a non-default language page removes the shared resource for all translations.

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

Content:

content/
├── de/
│   ├── my-bundle/
│   │   └── index.md   <-- draft = true
│   └── _index.md
├── en/                <-- this is the default content language
│   ├── my-bundle/
│   │   ├── a.jpg
│   │   └── index.md
│   └── _index.md
├── fr/
│   ├── my-bundle/
│   │   └── index.md
│   └── _index.md
└── _index.md

Expected output:

public/
├── de/
│   └── index.html
├── en/
│   ├── my-bundle/
│   │   ├── a.jpg
│   │   └── index.html
│   └── index.html
├── fr/
│   ├── my-bundle/
│   │   └── index.html
│   └── index.html
├── favicon.ico
└── index.html

Actual output:

public/
├── de/
│   └── index.html
├── en/
│   ├── my-bundle/
│   │   └── index.html
│   └── index.html
├── fr/
│   ├── my-bundle/
│   │   └── index.html
│   └── index.html
├── favicon.ico
└── index.html

Copy link

This issue 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 Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants