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

Glob patterns in v0.123.0 #11977

Closed
jmooring opened this issue Feb 3, 2024 · 4 comments
Closed

Glob patterns in v0.123.0 #11977

jmooring opened this issue Feb 3, 2024 · 4 comments
Assignees
Milestone

Comments

@jmooring
Copy link
Member

jmooring commented Feb 3, 2024

I was sort of expecting this, but using a path Glob pattern while cascading a value seems to look for the canonical page path.

I'm not sure this is a bug, but the behavior has changed from v0.122.0.

content/
├── posts/
│   ├── _index.de.md
│   ├── _index.en.md
│   ├── post-1.de.md
│   └── post-1.en.md
├── _index.de.md
└── _index.en.md

content/_index.de.md

[[cascade]]
[cascade.params]
foo = 'bar'
[cascade._target]
path = '/posts/post-1.de.md'

The above works in v0.122.0.

But this is required in v0.123.0:

[[cascade]]
[cascade.params]
foo = 'bar'
[cascade._target]
path = '/posts/post-1'

We use Glob patterns elsewhere, but I didn't check any of those.

I'm also not sure how the lang keyword is supposed to work in this situation. It seems like it should be ignored (it is) when cascading from a node.

Finally, the example above may not be realistic. I think in most cases the Glob pattern is used to target a directory instead of a page, but I could be wrong.

@bep bep removed the NeedsTriage label Feb 3, 2024
@bep bep self-assigned this Feb 3, 2024
@bep bep added this to the v0.123.0 milestone Feb 3, 2024
@bep
Copy link
Member

bep commented Feb 3, 2024

The above should work (for backwards compability), I guess (I find it unusual to have a Gob path pattern without any asterisk in it -- why not put that value directly into the file you target?)

Edit in: I will try to make the above cases work, but I will issue a warning about it. The meaning of Path has changed, and we have been announcing it for the last 2 years.

@bep bep added the v0.123-DEV label Feb 3, 2024
@bep
Copy link
Member

bep commented Feb 3, 2024

I'm also not sure how the lang keyword is supposed to work in this situation. It seems like it should be ignored (it is) when cascading from a node.

The lang keyword only makes sense in the config cascade. A content page is always attached to one language and cascaded is only applied to pages in the same language.

@bep
Copy link
Member

bep commented Feb 3, 2024

Edit in: I will try to make the above cases work, but I will issue a warning about it. The meaning of Path has changed, and we have been announcing it for the last 2 years.

Edit in again: I think we need to apply a proper fix here, else we're going to have to maintain these special cases forever.

  • We didn't have a single existing test case matching the above and I have never seen/used a pattern like that myself.
  • Therefore, I'm going to try to detect that pattern and log with Errorifd and link to your new Path docs page.

bep added a commit to bep/hugo that referenced this issue Feb 3, 2024
bep added a commit to bep/hugo that referenced this issue Feb 3, 2024
bep added a commit to bep/hugo that referenced this issue Feb 3, 2024
@bep bep closed this as completed in 058f230 Feb 3, 2024
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 Feb 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants