How to Fix "Error: Error building site: failed to render pages: JSON parse error: unexpected character" in Hugo


hugo blogging

Stay updated with my tutorials. Also, I will delight you with some bonus content.

I had this error while minified the blog using the hugo --minify command:

Error: Error building site: failed to render pages: JSON parse error

The full message for me was:

Error: Error building site: failed to render pages: JSON parse error: unexpected character ',' on line 6 and column 5

I fixed this error by restructuring under the content folder. My structure was like this:

content
  >page
    about.md
    products.md
    search.md
  >post
  archives.md

It depends on the template of how your structure should be implemented. The following structure helped me to fix this error:

the-fix-of-error-building-site-hugo

content
  >page
    about.md
    search.md
  archives.md
  products.md

In other words, I removed my custom page and leave only the default pages under the page directory.

comments powered by Disqus