Create new layout for an about page


#21

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 environnement variables do not seem to work


#22

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…


#23

will do give me a few minutes, thank you!


#24

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


#25

https://github.com/spf13/hugo/issues/2194

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


#26

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


#27

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.


#28

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


#29

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

Forgot to add a .

{{ partial “header.html” }}

becomes

{{ partial “header.html” . }}


#30

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


#43