[Solved] Posts in Netlify fail to load


#1

I deployed my first Hugo site to Netlify and, while the top level of the site loads, trying to load any of my indivdual posts results in an endless loop of trying to load the page without success.

I am not sure where to start to diagnose the problem. My website works OK locally on the test server. I setup my Netlify account and built the site without error. Address: circuidipity.netlify.com

I setup the domain configuration to direct www.circuidipity.com and circuidipity.com to Netlify and it works OK.

I visit www.circuidipity.com and it works OK. Visiting www.circuidipity.com/posts/ works OK. My custom 404 page loads OK when I enter a non-existing page OK.

But if I click on any of my posts the browser enters an endless loop of trying and failing to load the page. Does anyone have any insight to offer on this? Is there any log or test that I can run to perhaps shed more light on the issue? Thanks in advance for any help!


#2

You ought to link to your site’s source, so we can see how the ocnfig and site are set up. Always do that when seeking help. :slight_smile:

Have you asked Netlify about this? I don’t see any reason Hugo would be causing a loop, but DNS and redirects are almost always the culprit. Also, because your local site works elsewhere, something about Netlify is probably interacting with the DNS oddly.


#3

@maiki Thanks for responding … Here is the link to my site source: https://github.com/vonbrownie/circuidipity

I will post an inquiry to Netlify to see if they can shed light on the matter.


#4

Your posts have aliases set for them. It is creating double the amount of files, but also creating files that conflict with {post}/index.html page rendering.

I honestly don’t know if that is the issue, but I’d try removing that from a post, push the changes and check.

And a question: why do your posts have aliases set for them? :slight_smile:


#5

@maiki As per suggestion I tried removing the aliases entry on source file https://raw.githubusercontent.com/vonbrownie/circuidipity/master/content/posts/2017-07-15-virtualbox-debian-stretch.md

Now when I navigate to the file on Netlify http://www.circuidipity.com/virtualbox-debian-stretch/ I get the message Redirecting to /virtualbox-debian-stretch and the page stops loading.

My posts have aliases set for them because they all once carried the html extension and now I am using pretty URLs under Hugo.


#6

Netlify has their own way of doing redirects. I’d drop all the aliases in front matter, and instead create _redirects for all your old URLs. You can probably figure it out with a single rule and :splat to construct yer redirect.

Or, ya know, don’t worry about it. You only got like 70 pieces of content. It will get reindexed quickly, and you can put a mention on the 404 about it or something. :grimacing:

I would do anything aside from using aliases for your specific case, because it doubles the amount of content files you’ve got, and I don’t know, that just annoys me. Let’s keep those files down!

You can search the forums, there are a bunch of Netlify and alias conversations. Let me know how it goes. :slight_smile:


#7

@maiki I removed the aliases from the front matter and created a _redirects file as per the Netlify HOWTO, and all the posts and pages are now loading OK! Thanks so much for your help.


#8

I would recommend do something like in the Hugo docs:

I.e… keep the aliases in front matter and use them to create the redirects file.


#9

Pretty slick! The relevant _redirects template example is at index.redir.