[SOLVED] .Site.BaseURL doesn't lead back to homepage, Skeleton CSS not applied to single.html


#1

Hello,
I am building a simple site with two content pages. Should be so simple, but I can’t figure out two things:

  1. /layouts/partials/header Why does {{ .Site.BaseURL }} not create a link that will lead back to the homepage? (In config.toml I set BaseURL: “/”) When I replace .Site.BaseURL with ‘/’, the link leads back to homepage.

  2. I use the Skeleton CSS framework and have formatted /layouts/index.html and /layouts/_default/single.html in the same way, but only index.html gets properly formatted according to Skeleton CSS. Is there something I need to know about single.html properties?

Thanks!


#2

You are not passing the context (the “dot”) into the partial when you use it:

{{ partial "header.html" }} should be {{ partial "header.html" . }}

In your head.html you use a relative path for your css, so it looks for it in, for example, /about/css/...

<link rel="stylesheet" href="css/skeleton.css">

Consider using absURL: https://gohugo.io/functions/absurl#readout


#3

It worked!

worked after passing the context “dot” in both the index.html and the single.html

  1. 
    

That was a big help. I had looked into the doc before, also the section about absURL, but didn’t know what to look for. After your hint, I found this forum post which helped me with the format and how to apply it.

In the end this is the stylesheet reference in head.html

<link rel=“stylesheet” href="{{ “/css/skeleton.css” | absURL }}">

Thanks for the quick help!!! :star_struck: