With content/posts/news/
, I want the single pages in news
to share a custom single layout without needing to include the layout in every page. The workaround was using a partial and a conditional statement, but I would prefer to stick the layout in the default folder for future re-use.
layouts/
βββ _default/
βββ baseof.html
βββ foo.html <-------
βββ list.html
βββ single.html
content/posts/news/news-1.md
+++
title = 'News 1'
date = 2022-12-03T15:27:26-08:00
draft = false
layout = 'foo'
+++
I guess I will just stick to partials and conditional statements then since I am avoiding the solution you shared. Nested sections support is tricky!
I misunderstood your request.
layouts/
βββ _default/
βββ baseof.html
βββ foo.html <-------
βββ list.html
βββ single.html
content/posts/news/_index.md
+++
title = 'News'
date = 2022-12-03T15:46:30-08:00
draft = false
[[cascade]]
layout = 'foo'
+++
I tried cascade before posting the question but the pages are blank. A quick look and it was a -
placed in the Go comments block {{- /* */}}
that made the page blank. Such a minor mistake!
Thatβs a valid comment:
{{- /* Something */}}
In my local server it returns the βwhite page of deathβ (now it picks the 404 page). But It disappears when I close the comment with another -
. I placed it before {{ define "main" }}
.
{{- /* Something */ -}}
Then you have a different problem.
Just figured I did not specify placement. I edited my previous comment.
OK, thatβs a bug.
You can do this:
{{/* Foo */}}
{{ define "main" }}
but not this:
{{- /* Foo */}}
{{ define "main" }}
Is that Hugo Specific or Go specific bug?
Noted! I am not on Github otherwise I would have raised it.
Iβll create an issue. Itβs an easy fix.
Amazing!
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.