Browser showing error: unexpected token '<'


I’m working on my first hugo site and I’m getting an error I haven’t been able to figure out or find an answer to yet.

Chrome and Safari show the error Unexpected token: < in line one of Index which is

Looking around in chrome dev tools, it appears 2 index pages are loaded as shown in the screenshot. I’m guessing the error occurs when the browser see a second .

I’m running the server locally using hugo server -D and have installed one theme “hugo-kross”. I’ve copied some templates from the theme layouts directory to the site layouts directory so I can make changes. There are 2 index pages, one for the theme and one copied and changed for my site


Any suggestion on how to troubleshoot this problem?

Thank you.


Have a look at Requesting Help to see how we can help you.

1 Like

@pointyfar Thank you for pointing me to the help doc. To provide more info, I created a new site and found the issue started after adding the kross-hugo theme. After a bit of troubleshooting, I found this code in the footer partial was causing the issue.

{{ "<!-- Google Map API -->" | safeHTML }}
<script src="{{ .Site.Params.gmapAPI | absURL }}"></script> 

I think the problem was due to the variable .Site.Params.gmapAPI not being set and the pipe to absURL generating “http://localhost:1313/” as the script source.

I’ve created an issue in the theme repo.