Path based hugo website does not render css and js properly

Hello Support team,

I have a hugo site which was working fine when i had hosted on the main domain eg http://example.com/ However now i am trying to move my site under path eg. http://example.com/blog/
For this i have changed the baseURL value to http://example.com/blog/ After this i can access my site on url http://localhost:1313/blog/ However the css and js are not loading and rendering incorrect path.

Fyi. I have tried adding root = "/blog/" as well however the error is still there.
I am using puppet theme

The screenshot of 404 errors for js and css are attached.


Can you kindly guide me what should be updated to render site correctly.
Thanks in advance

You are more likely to receive a prompt and accurate response if you post a link to the public repository for your project.

See https://discourse.gohugo.io/t/requesting-help/9132.

Let us see your code

Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.

If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.

1 Like

Thanks i will follow.