Local build works, Netlify deploy does not see a data template range

Hello,

I’m puzzled on an issue with my Netlify deploy. I’ve built my site locally and it’s working fine. My Netlify deploy also builds just fine (no errors) but some pages are missing code that is generated in a range operation over some data in a data file (which shows up just fine in the local server/build).

Here is my partial that builds a bootstrap carousel.

<div class="container">
	<div id="carouselExampleSlidesOnly" class="carousel slide carousel-fade" data-bs-ride="carousel" data-bs-interval="5000">
		<div class="carousel-inner">

{{ range $index, $value := .Site.Data.params.carousel.images }}
<div class="carousel-item {{ if eq $index 0 }} active {{ end }}">
	<img class="d-block w-100" src="{{ $value.image }}" alt="{{ $value.title }}"/>
	<div class="carousel-caption d-nonen d-md-blockn">
		<h1>{{ $value.title }}</h1>
	</div>
</div>
{{ end }}
</div>
</div>
</div>

And here is my /Data/params.yaml file

################### Carousel ###################
carousel:
  images:
    - image: "images/carousel/Auto.jpg"
      title: "Auto Insurance"
    - image: "images/carousel/Home.jpg"
      title: "Homeowners Insurance"
    - image: "images/carousel/Life.jpg"
      title: "Life Insurance"
    - image: "images/carousel/Business.jpg"
      title: "Business Insurance"
    - image: "images/carousel/Rental.jpg"
      title: "Insurance for Rental Property"

The page generated by Netlify has the surrounding divs but the content inside the range is missing - as if it could not read the data file. Is the data directory name case sensitive? Mine is Data - does that matter? (but again, why does it work locally and not from Netlify?)

I’m using the same version of Hugo both locally and with Netlify. I’m not sure what else could be causing this.

Thanks for any insight.

Well, as usual, right after posting this I tried a fix and it worked.

I changed my yaml data file to json and everything works now. I’m still confused why it worked locally but not on Netlify. I pasted my yaml into an online linter and it validated so I don’t think it was a yaml format error.

Strange.

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