I am new to Hugo and using gohugotheme.
When i build with Hugo command my public folder is getting created and it has output folder which consists of CSS and JS folders(public/output/css).
I want to change it to something (public/public/output/css) folder structure.
public/public in your config file
This setting will change all the folders to public/public/. But i am trying to change only output/css to public/[somefolder]/output/css.
Only output folder path should be changed.
We’ll need to see how you’re currently constructing your CSS path, and where those CSS files live, in order to help you further
I have uploaded my Hugo here.
When i make hugo build my output folder is created at public/output.
what i am expecting the output is public/public/output.
Reason why i need this output folder inside public is.
Initially when i make hugo build my public folder is created and the directory structure is
and many single files
This is working in my hugo server.
I am using XAMPP server to deploy.
When i deploy public folder inside \xampp\htdocs .css and .js are not getting loaded. getting 404 exception.
The reason i have found is path is not correct for .css and .js files.
Copied my output folder inside public directory to \xampp\htdocs and .css and .js files were loaded properly and everything is working as expected.
I would like to change the path of output folder so that .css and .js files will be loaded.
If you have assets you want to be in a specific place under your site, just put them in
/static where you want them. Hugo will simply copy the content of that to
/public. So if you have
/static/path/to/my/main.css it will be copied to
/public/path/to/my/main.css. Then copy
/path/to/my/htdocs/ or wherever you’re serving from.
it is looking for css file at this location
@zwbetz have you got any chance to look at my code ?
I’m still not following what is happening. To clarify, you’re doing the following, right? Also, I am not familiar with xampp server.
- Your site runs and displays fine with
- Build site with
- Copy the contents of
public dir to
- CSS and JS files do not load
Yes correct. Xampp server internally uses Apache server.
Okay. So explain more what you did to “make it work”, and that may give us a hint on a solution
I have tried different ways to change the path of CSS file from
i am not sure how to do this.
Hmm. Perhaps someone else may help you. The issue is still not clear to me.
P.S. I’m suspicious of you having to edit deployed files. You shouldn’t have to do this.
What template code are you using to generate those strings in your
i have no idea about generate those strings in your
where can i find that information in my source code.
I have placed my source code at
In your theme, check layouts/_defaults/baseof.html.