Create new layout for an about page

Well when I go to : http://localhost:1313/about/

No css is loaded because the baseURL is not loaded.

./themes/mytheme/layouts/mylayout.html I added {{ partial "header.html" }}

in header.html I have :
link rel="stylesheet" href="{{ .Site.BaseURL }}css/style.css"

Which sould render to :
link rel="stylesheet" href="http://localhost:1313/css/style.css">

but in http://localhost:1313/about/ it renders to :
link rel="stylesheet" href="css/style.css">

So environnment variables do not seem to work

I’m sorry @stephenbe I think we might be using different terms here. You said you would have a repo to point me to in a few minutes. Can you point me in that direction? Thanks…

will do give me a few minutes, thank you!

So here is my about page
https://github.com/stephenbe/hugo-error/blob/master/content/about.md

https://github.com/stephenbe/hugo-error/tree/master/themes/blank/layouts/about

Here is the template that it uses
https://github.com/stephenbe/hugo-error/blob/master/themes/blank/layouts/about/single.html

Seems lik a known issue …

I had to use
{{ "vendors/N3UX/lib/externe/bootstrap/3.3.6/css/bootstrap.min.css" | absURL }}

To make this work =/

I asked @bep to re-open the issue

Actually no logic works anymore…if you add
{{- range first 10 .Data.Pages -}} <h4><a href="{{ .Permalink }}">{{ .Title }}</a></h4> {{- end }}

In about/single.html nothing shows up…what am I doing wrong? @rdwatters

This is a list page, so there is not .Data available to it by default. I would recommend reading the docs I sent along in the links above. All the answers will be in there, I promise :wink:`

I don’t now what you’re trying to range through, but the following will work in a single template:

{{- range first 10 $.Site.Pages -}}
<h4><a href="{{ .Permalink }}">{{ .Title }}</a></h4>
{{- end }}

But grabs all the pages for the site. I think you will benefit from learning some of the Hugo fundamentals; namely, the difference between list pages and single content pages.

1 Like

You are so right, I am very grateful for all your help, but I need to do some more reading on my part.

Thank you so much for all your help

1 Like

I discovered why the {{ .Site.BaseURL }} wasn’t working

Forgot to add a .

{{ partial “header.html” }}

becomes

{{ partial “header.html” . }}

2 Likes

13 posts were split to a new topic: Problems rendering a Contact Page partial and using Layout