Multilingual Cascade Targeting

I have a page to define some frontmatter for my author taxonomy and term pages in /content/author/_index.md. The file looks like this

---
title: Authors
cascade:
    - _target:
        lang: "*"
      heroClass: bg-light-01
      theme: extra-light
    - _target:
        lang: "*"
        kind: term
      supTitle: Author
    - _target:
        lang: "{fr,de,ko,zh,da,it,pt,sv}"
      render: false
---

It seems, however, that the language targeting isn’t working as none of the other languages (e.g. /ja/author/ or /ja/author/james/ receive those params.

Am I misunderstanding how this is supposed to work? Also wondering if it’s related to Cascade _target.kind not accepting glob pattern · Issue #8888 · gohugoio/hugo · GitHub.

1 Like

This works as expected when defined in site configuration:

[[cascade]]
foo = 'foo'
  [cascade._target]
  path = '/author**'
  lang = '*'  # You don't need to specify this; * is the default
[[cascade]]
bar = 'bar'
  [cascade._target]
  path = '/author**'
  lang = '*'  # You don't need to specify this; * is the default
  kind = 'term'
[[cascade]]
baz = 'baz'
  [cascade._target]
  path = '/author**'
  lang = '{en,es}'

Without looking at the code, in a multilingual site, if you define [[cascade]] in front matter, I would expect it to apply to the current site (language) only. Or to put it another way, I would not expect values in content/en/foo/_index.md to cascade onto content/fr/foo/something.

I think this is a documentation issue, but would appreciate confirmation/clarification from @bep.

This is not related to #8888.

1 Like

Yes, the cascade in front matter will only cascade down on the files in that site/language. You can also define a cascade section per language in config.toml, I guess.

So would it be more idiomatic to have a series of lang specific index files with the appropriate cascade? I.e. _index.en.md, _index.ja.md, etc.? I was attempting with a single _index.md but I assume that’s only used for the site default lang?

You either do it in site config, or on a per language basis in content. Pick one.

There’s less duplication and potential for error by keeping it one place.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.