Hugo version:
Hugo Static Site Generator v0.21-DEV-9EC00725 linux/amd64 BuildDate: 2017-04-10T15:58:13-04:00
I have a baseof.html
that looks like this:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us">
{{ partial "head.html" . }}
<body onload="prettyPrint()" class={{ (print "theme-base-0" .Site.Params.themecolorbase) }} lang="en">
<!-- Top color border of the page -->
<div class="border" id="home"></div>
<div class="wrapper">
{{ partial "navbar.html" . }}
<div class="masthead">
<div class="container">
<h1 class="masthead-title">
<p class="masthead-title-only">
<a href="/">{{ .Site.Title }}</a> <span class="blinking-cursor">❚</span>
</p>
</h1>
<h2 class="masthead-title">
<small>
{{ .Site.Params.tagline }}
</small>
</h2>
</div>
</div>
<div class="container">
{{ block "main" . }}{{ end }}
</div> <!-- - Closing <div class="wrap"> in default_head.html -->
</div> <!-- - Closing <div class="container"> in default_head.html -->
{{ "<!-- Google Analytics -->" | safeHTML }}
<!-- {{ template "_internal/google_analytics_async.html" . }} -->
{{ partial "googleanalytics.html" . }}
<script>
// Init responsive-nav.js
var nav = responsiveNav("#nav");
</script>
</body>
</html>
I’d like to use the main
block definition feature to avoid copy/pasting the default code. So a section layout page: layouts/section/bookmarks.html
looks like this:
{{ define "main" }}
Hi
{{ end }}
But that does not work! This worked at the time of 0.19 release, but broke at some point after that…
I do not also get any error when running hugo… just that I see a completely blank page on visiting the generated bookmarks.html.
But if I do not make use of the block feature, and copy paste everything from the baseof.html
, it works …
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us">
{{ partial "head.html" . }}
<body onload="prettyPrint()" class={{ (print "theme-base-0" .Site.Params.themecolorbase) }} lang="en">
<!-- Top color border of the page -->
<div class="border" id="home"></div>
<div class="wrapper">
{{ partial "navbar.html" . }}
<div class="masthead">
<div class="container">
<h1 class="masthead-title">
<p class="masthead-title-only">
<a href="/">{{ .Site.Title }}</a> <span class="blinking-cursor">❚</span>
</p>
</h1>
<h2 class="masthead-title">
<small>
{{ .Site.Params.tagline }}
</small>
</h2>
</div>
</div>
<div class="container">
Hi
</div> <!-- - Closing <div class="wrap"> in default_head.html -->
</div> <!-- - Closing <div class="container"> in default_head.html -->
{{ "<!-- Google Analytics -->" | safeHTML }}
<!-- {{ template "_internal/google_analytics_async.html" . }} -->
{{ partial "googleanalytics.html" . }}
<script>
// Init responsive-nav.js
var nav = responsiveNav("#nav");
</script>
</body>
</html>
- Is the method of using block in section layout changed?
- Is this a bug?