Can't access front matter parameters from the header template when not in default English langauge

<div class="container">
    <div class="row">
      <div class="col-sm-9">
        {{ if not .IsHome }}
    <h2 class="display-6">{{ .Params.Name }}</h2>
    {{ else }}
    <h2 class="display-6">{{ i18n "pricing-info" . }}</h2>
    {{ end }}
   <p class="lead">
      {{ .Params.Description }}
    </p>  
    </div>
    <div class="col-sm-3" style="display: flex; align-items: center;">
      <img src="{{ printf "https://%s" .Params.LargeImg }}" alt="{{ .Params.Name }} logo" width="43%">
    </div>
    </div>
  </div>

Now, when in the default English language, everything works fine, but when I switch to German, those {{ .Params.something }} doesn’t show.
Note I’m rebuilding pages from an API and mounting them to the directories:

[module]
  [[module.mounts]]
    source = 'prebuild/public/product'
    target = 'content'
    lang = 'en'
  [[module.mounts]]
    source = 'prebuild/public/product'
    target = 'content/de'
    lang = 'de'

Have you actually set those parameters in the German version of your content?

1 Like

@nternetinspired

There isn’t a German version of the content. This project mounts the same content to both langs.

@zzzela

Without seeing the entire project I am only guessing, but I suspect your mounts may be misconfigured. This example works as expected:

git clone --single-branch -b hugo-forum-topic-43979 https://github.com/jmooring/hugo-testing hugo-forum-topic-43979
cd hugo-forum-topic-43979
rm -rf resources/ public/ prebuild/resources/ prebuild/public/
hugo -s prebuild/ && hugo server

Look at the content structure in the main project, and examine the mounts in the main project’s configuration file.

1 Like

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