# Change output folder path in public folder

**URL:** https://discourse.gohugo.io/t/change-output-folder-path-in-public-folder/18636
**Category:** support
**Created:** [May 10, 2019, 9:49pm UTC](https://discourse.gohugo.io/t/change-output-folder-path-in-public-folder/18636 "2019-05-10T21:49:35Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![Kumar](https://avatars.discourse-cdn.com/v4/letter/k/9f8e36/32.png) [@Kumar](https://discourse.gohugo.io/u/Kumar)
#### Post date: [May 10, 2019, 9:49pm UTC](https://discourse.gohugo.io/t/change-output-folder-path-in-public-folder/18636/1 "2019-05-10T21:49:36Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![zwbetz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zwbetz/32/16088_2.png) [@zwbetz](https://discourse.gohugo.io/u/zwbetz)
#### Post date: [May 10, 2019, 10:27pm UTC](https://discourse.gohugo.io/t/change-output-folder-path-in-public-folder/18636/2 "2019-05-10T22:27:28Z")

</div>

Try setting `publishDir` to `public/public` in your config file

---

<div class="post-metadata">

### Author: ![Kumar](https://avatars.discourse-cdn.com/v4/letter/k/9f8e36/32.png) [@Kumar](https://discourse.gohugo.io/u/Kumar)
#### Post date: [May 10, 2019, 11:25pm UTC](https://discourse.gohugo.io/t/change-output-folder-path-in-public-folder/18636/3 "2019-05-10T23:25:03Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![zwbetz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zwbetz/32/16088_2.png) [@zwbetz](https://discourse.gohugo.io/u/zwbetz)
#### Post date: [May 11, 2019, 12:21am UTC](https://discourse.gohugo.io/t/change-output-folder-path-in-public-folder/18636/4 "2019-05-11T00:21:55Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Kumar](https://avatars.discourse-cdn.com/v4/letter/k/9f8e36/32.png) [@Kumar](https://discourse.gohugo.io/u/Kumar)
#### Post date: [May 12, 2019, 4:07pm UTC](https://discourse.gohugo.io/t/change-output-folder-path-in-public-folder/18636/5 "2019-05-12T16:07:41Z")

</div>

I have uploaded my Hugo here.

[https://drive.google.com/open?id=1WYtK2Knz-jJiMSUkwqO0kOATQQ4Jpi5d](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.

---

<div class="post-metadata">

### Author: ![RickCogley](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/rickcogley/32/10269_2.png) [@RickCogley](https://discourse.gohugo.io/u/RickCogley)
#### Post date: [May 13, 2019, 2:19pm UTC](https://discourse.gohugo.io/t/change-output-folder-path-in-public-folder/18636/6 "2019-05-13T14:19:30Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Kumar](https://avatars.discourse-cdn.com/v4/letter/k/9f8e36/32.png) [@Kumar](https://discourse.gohugo.io/u/Kumar)
#### Post date: [May 13, 2019, 3:00pm UTC](https://discourse.gohugo.io/t/change-output-folder-path-in-public-folder/18636/7 "2019-05-13T15:00:14Z")

</div>

it is looking for css file at this location

href="/output/css/app.min.7b23725c013f7650fd9e3f14b7f6b0bc02f71e14088ecd41bbe57661163fbcbb.css"

---

<div class="post-metadata">

### Author: ![Kumar](https://avatars.discourse-cdn.com/v4/letter/k/9f8e36/32.png) [@Kumar](https://discourse.gohugo.io/u/Kumar)
#### Post date: [May 13, 2019, 3:34pm UTC](https://discourse.gohugo.io/t/change-output-folder-path-in-public-folder/18636/8 "2019-05-13T15:34:27Z")

</div>

@zwbetz have you got any chance to look at my code ?

---

<div class="post-metadata">

### Author: ![zwbetz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zwbetz/32/16088_2.png) [@zwbetz](https://discourse.gohugo.io/u/zwbetz)
#### Post date: [May 13, 2019, 3:40pm UTC](https://discourse.gohugo.io/t/change-output-folder-path-in-public-folder/18636/9 "2019-05-13T15:40:56Z")

</div>

> [@Kumar](#):
>
> 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’m still not following what is happening. To clarify, you’re doing the following, right? Also, I am not familiar with xampp server.

1. Your site runs and displays fine with `hugo server`
2. Build site with `hugo`
3. Copy the contents of `public` dir to `\xampp\htdocs`
4. CSS and JS files do not load

---

<div class="post-metadata">

### Author: ![Kumar](https://avatars.discourse-cdn.com/v4/letter/k/9f8e36/32.png) [@Kumar](https://discourse.gohugo.io/u/Kumar)
#### Post date: [May 13, 2019, 3:48pm UTC](https://discourse.gohugo.io/t/change-output-folder-path-in-public-folder/18636/10 "2019-05-13T15:48:42Z")

</div>

Yes correct. Xampp server internally uses Apache server.

---

<div class="post-metadata">

### Author: ![zwbetz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zwbetz/32/16088_2.png) [@zwbetz](https://discourse.gohugo.io/u/zwbetz)
#### Post date: [May 13, 2019, 4:05pm UTC](https://discourse.gohugo.io/t/change-output-folder-path-in-public-folder/18636/11 "2019-05-13T16:05:22Z")

</div>

Okay. So explain more what you did to “make it work”, and that may give us a hint on a solution

---

<div class="post-metadata">

### Author: ![Kumar](https://avatars.discourse-cdn.com/v4/letter/k/9f8e36/32.png) [@Kumar](https://discourse.gohugo.io/u/Kumar)
#### Post date: [May 13, 2019, 4:13pm UTC](https://discourse.gohugo.io/t/change-output-folder-path-in-public-folder/18636/12 "2019-05-13T16:13:40Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![zwbetz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zwbetz/32/16088_2.png) [@zwbetz](https://discourse.gohugo.io/u/zwbetz)
#### Post date: [May 13, 2019, 4:19pm UTC](https://discourse.gohugo.io/t/change-output-folder-path-in-public-folder/18636/13 "2019-05-13T16:19:35Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![RickCogley](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/rickcogley/32/10269_2.png) [@RickCogley](https://discourse.gohugo.io/u/RickCogley)
#### Post date: [May 13, 2019, 10:57pm UTC](https://discourse.gohugo.io/t/change-output-folder-path-in-public-folder/18636/14 "2019-05-13T22:57:58Z")

</div>

What template code are you using to generate those strings in your `<head>`?

---

<div class="post-metadata">

### Author: ![Kumar](https://avatars.discourse-cdn.com/v4/letter/k/9f8e36/32.png) [@Kumar](https://discourse.gohugo.io/u/Kumar)
#### Post date: [May 14, 2019, 7:32pm UTC](https://discourse.gohugo.io/t/change-output-folder-path-in-public-folder/18636/15 "2019-05-14T19:32:49Z")

</div>

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](https://drive.google.com/open?id=1WYtK2Knz-jJiMSUkwqO0kOATQQ4Jpi5d)

---

<div class="post-metadata">

### Author: ![RickCogley](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/rickcogley/32/10269_2.png) [@RickCogley](https://discourse.gohugo.io/u/RickCogley)
#### Post date: [May 14, 2019, 7:45pm UTC](https://discourse.gohugo.io/t/change-output-folder-path-in-public-folder/18636/16 "2019-05-14T19:45:16Z")

</div>

In your theme, check layouts/\_defaults/baseof.html.
