Hugo: Example blog doesn't work

Created on 14 Jan 2020  Â·  1Comment  Â·  Source: gohugoio/hugo

The example blog provided in examples/ seems to be obsolete when ran with up-to-date Hugo version:

marc@cobalt:~/hugo/examples/blog$ hugo
Building sites … WARN 2020/01/14 10:35:41 found no layout file for "HTML" for "taxonomy": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2020/01/14 10:35:41 found no layout file for "HTML" for "taxonomyTerm": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2020/01/14 10:35:41 found no layout file for "HTML" for "taxonomy": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2020/01/14 10:35:41 found no layout file for "HTML" for "taxonomy": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2020/01/14 10:35:41 found no layout file for "HTML" for "taxonomy": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2020/01/14 10:35:41 found no layout file for "HTML" for "taxonomyTerm": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2020/01/14 10:35:41 found no layout file for "HTML" for "taxonomy": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2020/01/14 10:35:41 found no layout file for "HTML" for "taxonomy": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2020/01/14 10:35:41 found no layout file for "HTML" for "section": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2020/01/14 10:35:41 found no layout file for "HTML" for "taxonomy": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
Total in 18 ms
Error: Error building site: failed to render pages: render of "home" failed: "/var/folders/qb/512rrh_n51x1fb40yc3l1sj40000gn/T/tmp.n7Ecxv4E/hugo/examples/blog/layouts/index.html:10:90": execute of template failed: template: index.html:1:3: executing "index.html" at <partial "header.html" .>: error calling partial: "/var/folders/qb/512rrh_n51x1fb40yc3l1sj40000gn/T/tmp.n7Ecxv4E/hugo/examples/blog/layouts/partials/header.html:10:90": execute of template failed: template: partials/header.html:10:90: executing "partials/header.html" at <.Title>: can't evaluate field Title in type *page.OutputFormat

The compilation error can be fixed with this change:

--- a/examples/blog/layouts/partials/header.html
+++ b/examples/blog/layouts/partials/header.html
@@ -7,6 +7,6 @@
     <link rel="canonical" href="{{ .Permalink }}">
     {{ partial "header.includes.html" . }}
     {{ with .OutputFormats.Get "RSS" -}}
-    {{ printf "<link href=%q rel=\"alternate\" type=%q title=%q />" .Permalink .MediaType .Title | safeHTML }}
+    {{ printf "<link href=%q rel=\"alternate\" type=%q title=%q />" .Permalink .MediaType $.Site.Title | safeHTML }}
     {{- end }}
 </head>

However even when fixing the compilation error, the rendered blog is broken (clicking on either Posts or Read More lead to a blank page):

Screenshot 2020-01-14 at 10 38 02

What version of Hugo are you using (hugo version)?

$ hugo version
Hugo Static Site Generator v0.62.2/extended darwin/amd64 BuildDate: unknown

Does this issue reproduce with the latest release?

Yes

Bug

Most helpful comment

Hi, just spent some time fixing up the blog, please take a look at PR #6772. It looks like it had not been updated for some time. I moved around a few of the pages, and that fixed the broken pages. After applying the fix posted by @falzm to the header partial.

Thanks!

>All comments

Hi, just spent some time fixing up the blog, please take a look at PR #6772. It looks like it had not been updated for some time. I moved around a few of the pages, and that fixed the broken pages. After applying the fix posted by @falzm to the header partial.

Thanks!

Was this page helpful?
0 / 5 - 0 ratings