Partials displaying no content using "portio" theme after multi-lingual changes in Hugo v0.112.0

Greetings all, extremely new Hugo developer here and new to this forum, please feel free to offer feedback on both this question and how I’m asking it:

The organization where I work has a number of small multilingual sites using Hugo with the “portio” theme from StaticMania (here is their theme repo link and their web site) and in recent weeks, after the release of Hugo v0.112.0 which changes certain language-related variables, those sites have stopped building properly.

What happens, exactly, is that partials which would previously have shown up and displayed their content correctly based on language are not rendering content at all. The pages essentially have top navigation and footers, but no content is displayed in between by any “section” partials. Here are examples of two such partials from the simplest of the sites:


{{ $data := index site.Data site.Language.Lang }}

{{ if $data.hero.enable }}
{{ with $data.hero }}
<section class="hero" id="home">
  <div class="container">
    <div class="row">
      <div class="col-lg-10">
        <div class="hero_content">
          <div class="mb-5">
            <h1>{{ .title }}</h1>
            {{ .content | markdownify }}
      <div class="col-lg-2">
        <div class="hero_figure">
          <img src="{{ .image | relURL }}" alt="{{ .imageDescription }}" />
{{ end }}
{{ end }}


{{ $data := index site.Data site.Language.Lang }}

{{ if $data.serviceSection.enable }}
{{ with $data.serviceSection }}
<section class="section service" id="service">
    <div class="container">
        <div class="row">
                    {{ $Section := .service }}
                    {{ range $Section }}
                    <div class="service__slider_item col-lg-4">
                        <div class="service__slider_item-icon">
                        {{ if .image  }}
                            <h2 class="icon">
                                <img src="{{ .image | relURL }} " alt="{{ .imageDescription }}">
                        {{ end }}
                        <div class="mt-5">
                            <h3 class="">{{ .ctaTitle }}</h3>
                            <a class="btn btn-primary mb-3 mr-3 btn-zoom"
                            href="{{ .ctaTarget | safeURL }}"><i class="fa fa-2x {{ .ctaIcon }}"></i> {{ .ctaName }}</a>             
                        {{ if .infoTarget  }}
                            <a class="btn btn-secondary mb-3 mr-3 btn-zoom"
                            href="{{ .infoTarget | relURL }}"> {{ .infoName }}</a>
                        {{ end }}
                    {{ end }}
{{ end }}
{{ end }}

I should probably add that I didn’t develop this site, but I’ve inherited its care and need to figure out how to fix whatever’s happening. We serve these sites from GitLab Pages, and recently I noticed that they weren’t building correctly using “latest” Hugo there, while working fine locally using slightly older Hugo. I noticed it wasn’t a GitLab problem when I updated my local Hugo environment past v0.112.0 and the same thing started happening.

I can keep the sites working by changing their CI/CD configuration at GitLab to just keep using an older version instead of “latest” but that hardly seems optimal, plus I would like to figure out and fix whatever is wrong so it doesn’t come up regarding sites we build in the future.

Here is the output of “hugo env” on my local machine, where I can now reproduce the problem (but have not been able to fix it).

hugo v0.113.0+extended darwin/arm64 BuildDate=unknown

I believe the problem is being caused by the use of outdated variable naming like site.Language.Lang, but what’s confusing to me is that even when I use variables that still exist in current Hugo like site.LanguageCode or even hard code in “en” or “fr” or the like, something about the logic in these templates still fails. If I just dump out the contents of site.Data, I can see that it all exists, but for some reason the tests/iterating that used to output the page content are just not working now.

Thank you so much in advance to anyone who can point me in the right direction! :pray:

site.Language.Lang isn’t outdated.

I don’t see anything in the templates you show that should not work as expected, which means that the issue must live somewhere else (I guess the configuration, but it’s not possible to tell without seeing a complete source).

1 Like

You just blew my mind! Thank you so much, for some reason I was completely convinced that while working on my older version, that variable was coming up undefined on my newer one…but I must have made a sleepless mistake someplace while tracing through what could be keeping the content from showing. I misunderstood the 0.112.0 messaging about the “Params” namespace.

Now of course, I need to figure out why this code would be breaking after 0.112.0, when it all worked fine before, for example if site.Data full of stuff then why is if $data.hero.enable failing to trigger when it used to be fine?

I apologize that our repo where the sites are isn’t public, but if it helps here is a peek at my config file:


baseURL = ""
relativeURLs = true
paginate = 10
theme = "portio"
title = 'Turn “I am here” into “I am home”'
languageCode = "en-ca"
DefaultContentLanguage = "en"
defaultContentLanguageInSubdir = true

googleAnalytics = "G-BQN7ZX3JJY"

# Main Menu
# [[menu.main]]
# name = "Home"
# url = "en"
# weight = 1
# [[menu.main]]
# name = "OCASI"
# url = "en/about/"
# weight = 2
# [[menu.main]]
# name = "Work"
# url = "en/work/"
# weight = 3
# [[menu.main]]
# name = "Agencies"
# url = "en/agencies/"
# weight = 4
# [[menu.main]]
# name = "Staff"
# # url = "en/staff/"
# weight = 5
# [[menu.main]]
# name = "Financial"
# url = "en/financial/"
# weight = 6

    languageName = "English"
    languageCode = "en-ca"
    contentDir = "content/english"
    dataDir = "data/en"
    title = 'Turn “I am here” into “I am home”'
    weight = 1
      footerCopyright = 'Copyright © 2023 <a class="text-light" href="">Ontario Council of Agencies Serving Immigrants</a>. All rights reserved.'
      footerTermsAndConditions = 'Use of this webpage constitutes acceptance of the <a href="">Terms and Conditions</a> and <a href="">Privacy Statement</a>.'
    languageName = "Français"
    languageCode = "fr-ca"
    contentDir = "content/french"
    dataDir = "data/fr"
    title = 'Transformer "je suis ici" en "je suis chez moi"'
    weight = 2
      footerCopyright = 'Droits d&apos;auteur © 2023 <a class="text-light" href="">Ontario Council of Agencies Serving Immigrants</a>. Tous droits réservés.'
      footerTermsAndConditions = 'L&apos;utilisation de ce site Web constitue l&apos;acceptation des <a href="">modalités et conditions d&apos;utilisation</a> et <a href="">la déclaration sur la protection des renseignements personnels.</a>'
    languageName = "Arabic"
    languageCode = "ar"
    contentDir = "content/arabic"
    dataDir = "data/ar"
    title = 'عنوان الصفحة: تحول من " أنا هنا" إلى "أنا في وطني"'
    weight = 3
      footerCopyright = 'حقوق النشر © 2023 <a class="text-light" href="">مجلس مؤسسات أونتاريو التي تخدم المهاجرين</a>. كل الحقوق محفوظة.'
      footerTermsAndConditions = 'يشكل استخدام صفحة الويب هذه قبولًا <a href="">للشروط والأحكام</a> <a href="">وبيان الخصوصية</a>.'
    languageName = "Ukrainian"
    languageCode = "uk"
    contentDir = "content/ukrainian"
    dataDir = "data/uk"
    title = "Назва сторінки: Перетворіть «Я тут» на «Я вдома»"
    weight = 4
      footerCopyright = 'Авторське право © 2023 <a class="text-light" href="">Рада агентств Онтаріо з обслуговування іммігрантів</a>. Всі права захищені.'
      footerTermsAndConditions = 'Використання цієї веб-сторінки означає згоду з <a href="">Умовами</a> and <a href="">Заявою про конфіденційність</a>.'
#          [[]]
#            name = "Accueil"
#            url = "fr"
#            weight = 1
#          [[]]
#            name = "OCASI"
#            url = "fr/about/"
#            weight = 2
#          [[]]
#            name = "Travail"
#            url = "fr/work/"
#            weight = 3
#          [[]]
#            name = "Agencies"
#            url = "fr/agencies/"
#            weight = 4
#          [[]]
#            name = "Personnel"
#            url = "fr/staff/"
#            weight = 5
#          [[]]
#            name = "Financier"
#            url = "fr/financial/"
#            weight = 6

logo = "logo-settlement.png"
summary = "Place SEO-friendly webpage summary here."

decorativeAltDescription = ""

copyright = "All right reserved copyright © Portio 2020"
footerLogo = "images/footer/logo-ocasi-white.png"

# We're using for form handling, paste your formspree url below
# fabformURL  = ""
# googleAnalytics = "G-BQN7ZX3JJY"


OK, we have only ever supported 1 dataDir (I’m pretty sure about that). So in your case you need to pick one and move the dataDir setting up to the site level.

I wonder if my problem is this dataDir thing, which might be getting set superfluously?

The way we have our files laid out is very similar to what was suggested here…

…but it seems like with proper indexing files organized into language-code-named subfolders should be pretty easily referenced?

Yes, it is superfluous, because you are doing this:

THANK YOU that turned out to be exactly my problem. I think the person who took care of these sites before me didn’t quite understand that such declarations weren’t necessary, and in time it ended up coming back to bite us. Everything works great now that I removed those.

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