Kumar
May 10, 2019, 9:49pm
1
Hi,
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.
zwbetz
May 10, 2019, 10:27pm
2
Try setting publishDir
to public/public
in your config file
1 Like
Kumar
May 10, 2019, 11:25pm
3
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.
zwbetz
May 11, 2019, 12:21am
4
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
Kumar
May 12, 2019, 4:07pm
5
I have uploaded my Hugo here.
https://drive.google.com/open?id=1WYtK2Knz-jJiMSUkwqO0kOATQQ4Jpi5d
When i make hugo build my output folder is created at public/output.
what i am expecting the output is public/public/output.
Actual Problem
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
Public
api-reference
categories
css
dist
documentation
fonts
getting-started
images
img
output
share
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 /public/*
to /path/to/my/htdocs/
or wherever you’re serving from.
1 Like
Kumar
May 13, 2019, 3:00pm
7
it is looking for css file at this location
href="/output/css/app.min.7b23725c013f7650fd9e3f14b7f6b0bc02f71e14088ecd41bbe57661163fbcbb.css"
Kumar
May 13, 2019, 3:34pm
8
@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 hugo server
Build site with hugo
Copy the contents of public
dir to \xampp\htdocs
CSS and JS files do not load
Kumar
May 13, 2019, 3:48pm
10
Yes correct. Xampp server internally uses Apache server.
zwbetz
May 13, 2019, 4:05pm
11
Okay. So explain more what you did to “make it work”, and that may give us a hint on a solution
Kumar
May 13, 2019, 4:13pm
12
I have tried different ways to change the path of CSS file from
href="**/output/css/app.min.**7b23725c013f7650fd9e3f14b7f6b0bc02f71e14088ecd41bbe57661163fbcbb.css"
to
href="/public/output/css/app.min .7b23725c013f7650fd9e3f14b7f6b0bc02f71e14088ecd41bbe57661163fbcbb.css"
i am not sure how to do this.
zwbetz
May 13, 2019, 4:19pm
13
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 <head>
?
Kumar
May 14, 2019, 7:32pm
15
i have no idea about generate those strings in your <head>
?
where can i find that information in my source code.
I have placed my source code at
https://drive.google.com/open?id=1WYtK2Knz-jJiMSUkwqO0kOATQQ4Jpi5d
In your theme, check layouts/_defaults/baseof.html.