Partials sometimes do not render after each build

Strange things are happening after each Hugo build. One of our Hugo website page’s partial shows blank HTML some times. But some time it shows perfectly. The partials are generated through a “range” loop of JSON data that kept in the data folder. So it generated 6 partials through this loop. In that partials, any one of them will be blank HTML some times. But sometimes it is working perfectly. Please check my partial.

`

            {{ $context := . }}

            {{ $siteData := $.Site.Data.communities }}

            {{ $owlType := "Medigy Communities"}}

            {{ range $siteData }}

                {{ range sort .topicDetails "representationOrder" "asc" }}

                {{ $.Scratch.Set "tagCounter" 0 }}

                {{ $topicTitle := print "Medigy: " .topicTitle }}

                {{ range  (where $.Site.RegularPages ".Params.owltype" "==" $owlType ) }}

                    {{ if in .Params.communityTopics $topicTitle }}

                    {{ $.Scratch.Add "tagCounter" 1 }}

                    {{ end }}

                {{ end }}                       

                {{ $topicCollections := print .topicTitle }}

                {{ $textLower := ($topicCollections | lower) }}

                {{ $communityUrlCreated := print "/chronic-care-management-ccm/chronic-care-management-ccm" "/communities/chronic-care-management-ccm/medigy-" ($textLower | urlize) }}

                {{ if eq ( $.Scratch.Get "tagCounter" ) 0}}

                    {{ $communityUrlCreated = "#"}}

                {{ end }}

    

                <div class="femtech-content-left-secion">

                    {{ partial (print ($.Scratch.Get "bundle") ) (dict "communityUrlCreated" $communityUrlCreated "staticPath" "/communities/medigy-chronic-care-management-ccm" "headText" .topicTitle "owlType" $owlType "href" ( print "/" ($.Scratch.Get "contentPath") "curated-video" ) "contentcategories" "medigy-chronic-care-management-ccm-curated-video" "featuredImage" (print ($.Scratch.Get "basePath" ) .topicFeaturedImage ) "descptText" .topicDescription  "context"  $context )  }}              

                </div>

                {{ end }}

            {{ end }}

        </div>

`

The above issue is after once the build occur.
Please check the given below screen shot after another build occur.

Strange things are happening. I cannot figure out the reason for this issue.

Actually this partial is calling from another partial. I mean that inside another partial. My Hugo version is 0.75.1 . Is this a Hugo issue or server side issue or something I written in wrong way?

Hi there,

Please have a read through Requesting Help . We need to be able to see your whole site code so we can replicate your issue to help you.

@jijomp

Please do not post long descriptions in a topic’s title.

Thank you.

1 Like

Sorry for the same.

I’m almost certain what you see is the result of parallelism.

I recommend that you rewrite the scratch construct to use regular variables. If you want to use scratch you need to do something like:

{{ $scratch := newScratch }}

And then use that scratch.

1 Like

@bep Thanks for your reply. Let me try it.

@bep Sorry for the slow reply. Thanks for the valuable input. I applied those changes in my code and now it is working fine. I am still verifying after each Hugo build process. Once I had tried the above changes into that code, but at that time it did not succeed. It was due to my mistake.
I am very much interested in Hugo and to learn more and more about it. Thanks for the great invention.

1 Like

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