Nunjucks Not Working When Uploaded to Netlify?

Hey everyone!

I’ve been tentatively following this tutorial here: Turn static HTML/CSS into a blog with CMS using the JAMStack - YouTube

It’s been extremely useful in setting up a website that I intend to use as a personal portfolio/resume for my work during my Computer Science Schooling.

I’ve got something that I’m content with for now and it seems to be working fine when I use “npm start” to run locally, however when I upload it to netlfiy, it’s looks like the .njk files aren’t being read or displayed properly?

New Users can only post 1 media item so for example, here’s what the Blog Page is supposed to look like:

I’ll attach some pictures comparing what it looks like locally, versus when hosted on Netlify. I’m sure it’s a configuration setting somewhere that I missed but I’m new to nunjucks, 11ty, css, html, and all of it so I’m having difficulties knowing where to start troubleshooting. Whenever I find a forum that looks like they’re having similar issues, it seems like it stems from issues revolving around the _includes folder, but I have that so I’m not sure that’s my issue.

Finally, here’s the link to the current live website: Home Page
The home page seems fine, more or less, but all other pages are messed up in weird ways.

Thank again for info or support!

Aha! I think I figured it out.

I think what happened was that whenever I ran locally with “npm start” it would generate the ‘public’ folder in my main directory.

I would just push everything onto github, causing my public folder to go as well. This ended up causing issues since the public also has a _includes and netlify didn’t distinguish between /src/ and /public/.

Nonetheless, deleting my /public/ folder from github and clearing the cache then re-deploying the site seemed to fix the issue.

1 Like

Hey there, @IndentYourCode :wave:

Thanks so much for coming back and letting us know! Glad everything is working now.

Happy building :netliconfetti: