# Lost css

**URL:** <https://discourse.gohugo.io/t/lost-css/872>\
**Category:** support\
**Created:** [March 12, 2015, 11:27am UTC](https://discourse.gohugo.io/t/lost-css/872 "2015-03-12T11:27:12Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![bucksci](https://avatars.discourse-cdn.com/v4/letter/b/a88e4f/32.png) [@bucksci](https://discourse.gohugo.io/u/bucksci)\
**Post date:** [March 12, 2015, 11:27am UTC](https://discourse.gohugo.io/t/lost-css/872/1 "2015-03-12T11:27:12Z")

</div>

Can someone help me with the path for my css?

as normal, in the public folder there is

/404  
/fonts  
/css  
etc

and when I add the homepage index.html it is fine. however when I add other single pages, it cannot see the css from the folder it creates for the new post. ie in

/post

the original css path in the template is css/style.css, but that is obviously wrong for the new post.

I have tried …/css/style.css but that isn’t finding it.

---

<div class="post-metadata">

**Author:** ![spf13](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/spf13/32/37_2.png) [@spf13](https://discourse.gohugo.io/u/spf13)\
**Post date:** [March 12, 2015, 12:56pm UTC](https://discourse.gohugo.io/t/lost-css/872/2 "2015-03-12T12:56:06Z")

</div>

Can you provide more details around what your static directory looks like?

---

<div class="post-metadata">

**Author:** ![bucksci](https://avatars.discourse-cdn.com/v4/letter/b/a88e4f/32.png) [@bucksci](https://discourse.gohugo.io/u/bucksci)\
**Post date:** [March 12, 2015, 1:03pm UTC](https://discourse.gohugo.io/t/lost-css/872/3 "2015-03-12T13:03:08Z")

</div>

erm, yes:  
it has subfolders:  
/css  
/fonts  
/images  
/js

the style.css is a file in the /css subfolder

---

<div class="post-metadata">

**Author:** ![spf13](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/spf13/32/37_2.png) [@spf13](https://discourse.gohugo.io/u/spf13)\
**Post date:** [March 12, 2015, 3:01pm UTC](https://discourse.gohugo.io/t/lost-css/872/4 "2015-03-12T15:01:00Z")

</div>

Can you try

`/css/style.css`

---

<div class="post-metadata">

**Author:** ![bucksci](https://avatars.discourse-cdn.com/v4/letter/b/a88e4f/32.png) [@bucksci](https://discourse.gohugo.io/u/bucksci)\
**Post date:** [March 12, 2015, 3:10pm UTC](https://discourse.gohugo.io/t/lost-css/872/5 "2015-03-12T15:10:36Z")

</div>

I think the problem is that the template is calling the js as well as the css - but I can’t work out what the path should be, so it isn’t displaying

I have tried /css/style.css and …/style.css and …/…/style.css but none of them seem to work. Maybe I’ll have to abandon this template! any html in the main /public folder seems to work when …/public/css is used, but nothing seems to work when there is an index.html file in a subdirectory like /post

```
<script src="../../public/js/jquery.min.js"></script> 
        <script src="../../public/js/jquery.dropotron.min.js"></script> 
        <script src="../../public/js/skel.min.js"></script> 
        <script src="../../public/js/skel-layers.min.js"></script> 
        <script src="../../public/js/init.js"></script> 
        <noscript> 
            <link rel="stylesheet" href="../../public/css/skel.css" /> 
            <link rel="stylesheet" href="../../public/css/style.css" /> 
            <link rel="stylesheet" href="../../public/css/style-desktop.css" /> 
        </noscript>
```

---

<div class="post-metadata">

**Author:** ![bucksci](https://avatars.discourse-cdn.com/v4/letter/b/a88e4f/32.png) [@bucksci](https://discourse.gohugo.io/u/bucksci)\
**Post date:** [March 12, 2015, 3:24pm UTC](https://discourse.gohugo.io/t/lost-css/872/6 "2015-03-12T15:24:18Z")

</div>

maybe I’ll just try putting all of the scripts directly inside the head.

---

<div class="post-metadata">

**Author:** ![michael\_henderson](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/michael_henderson/32/10490_2.png) [@michael\_henderson](https://discourse.gohugo.io/u/michael_henderson)\
**Post date:** [March 12, 2015, 4:35pm UTC](https://discourse.gohugo.io/t/lost-css/872/7 "2015-03-12T16:35:45Z")

</div>

`public` shouldn’t be in your path at all. If you have your `css/` stowed in the `static/` directory, Hugo will copy it into `public/` automatically. But `public` is the “root” of your site - it’s not part of it.

Have you tried `{{ .Site.BaseURL }}js/query.min.js` in your template?

---

<div class="post-metadata">

**Author:** ![bucksci](https://avatars.discourse-cdn.com/v4/letter/b/a88e4f/32.png) [@bucksci](https://discourse.gohugo.io/u/bucksci)\
**Post date:** [March 12, 2015, 5:00pm UTC](https://discourse.gohugo.io/t/lost-css/872/8 "2015-03-12T17:00:10Z")

</div>

By a process of elimination, I have been able to work out that it is the js init.js which is causing the problem - it is what is making the site dynamic so determining which css to load.

I have been able to load it hosting the js and css elsewhere, but I will try your path suggestion…

---

<div class="post-metadata">

**Author:** ![bucksci](https://avatars.discourse-cdn.com/v4/letter/b/a88e4f/32.png) [@bucksci](https://discourse.gohugo.io/u/bucksci)\
**Post date:** [March 12, 2015, 5:14pm UTC](https://discourse.gohugo.io/t/lost-css/872/9 "2015-03-12T17:14:23Z")

</div>

it says Error while rendering homepage: template: index.html:14:23: executing “index.html” at \<.Site.BaseURL\>: BaseURL is not a field of struct type \*hugolib.SiteInfo

I have set the baseurl as file///path/to in config but I’m not sure what this should be in this instance.

---

<div class="post-metadata">

**Author:** ![michael\_henderson](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/michael_henderson/32/10490_2.png) [@michael\_henderson](https://discourse.gohugo.io/u/michael_henderson)\
**Post date:** [March 12, 2015, 6:23pm UTC](https://discourse.gohugo.io/t/lost-css/872/10 "2015-03-12T18:23:41Z")

</div>

Here’s a full example of BaseURL:

```auto
<a class="blog-logo" href="{{ .Permalink }}"><img src="{{.Site.BaseUrl}}{{ .Site.Params.logo }}" alt="Blog Logo" /></a>

```

What does it look like in your `index.html` file?

In the `config.toml`, this is what it should look like:

```auto
baseurl = "http://www.example.com"
languageCode = "en-us"

```

---

<div class="post-metadata">

**Author:** ![bucksci](https://avatars.discourse-cdn.com/v4/letter/b/a88e4f/32.png) [@bucksci](https://discourse.gohugo.io/u/bucksci)\
**Post date:** [March 12, 2015, 9:08pm UTC](https://discourse.gohugo.io/t/lost-css/872/11 "2015-03-12T21:08:17Z")

</div>

hum. well I found that one of the problems was that canonifyurls was set to true. So Site.BaseUrl works now, but obviously I need to put in something else other than [example.com](http://example.com)…

Great, I have it working now. unfortunately I don’t think this will work in the js, but finally some progress! thanks for your help.

---

<div class="post-metadata">

**Author:** ![bucksci](https://avatars.discourse-cdn.com/v4/letter/b/a88e4f/32.png) [@bucksci](https://discourse.gohugo.io/u/bucksci)\
**Post date:** [March 13, 2015, 1:30pm UTC](https://discourse.gohugo.io/t/lost-css/872/12 "2015-03-13T13:30:12Z")

</div>

Any ideas how I can get the css and js files to path back to root? I have tried to use …/ as they are not going to be moving, but that doesn’t seem to have the desired effect.

---

<div class="post-metadata">

**Author:** ![bucksci](https://avatars.discourse-cdn.com/v4/letter/b/a88e4f/32.png) [@bucksci](https://discourse.gohugo.io/u/bucksci)\
**Post date:** [March 13, 2015, 2:09pm UTC](https://discourse.gohugo.io/t/lost-css/872/13 "2015-03-13T14:09:21Z")

</div>

done - I wasn’t going far enough back with the /path
