diff options
author | Olivier Fredon <the2ne@gmail.com> | 2019-08-23 15:30:50 +0300 |
---|---|---|
committer | Olivier Fredon <the2ne@gmail.com> | 2019-08-23 15:30:50 +0300 |
commit | cd01972645a360fa75b093e8351f5f1f6214db09 (patch) | |
tree | 472766e4368395bd125236dd877873e82c3f0f05 | |
parent | 393298e27b4207086785accb39fd41eb5b09a638 (diff) |
theme update for Hugo 0.57
-rw-r--r-- | exampleSite/config.toml | 1 | ||||
-rw-r--r-- | exampleSite/content/post/creating-a-new-theme.md | 12 | ||||
-rw-r--r-- | layouts/index.html | 2 | ||||
-rw-r--r-- | layouts/partials/head.html | 5 | ||||
-rw-r--r-- | layouts/partials/post-list.html | 2 |
5 files changed, 12 insertions, 10 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 7e51457..bb2e3f0 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -12,6 +12,7 @@ theme = "hugo-frais" linkedin = "the2ne" headline = "Hugo Frais" description = "This is the sites description, which will be found in the meta tags." + mainSections = ["blog", "post"] [taxonomies] category = "categories" diff --git a/exampleSite/content/post/creating-a-new-theme.md b/exampleSite/content/post/creating-a-new-theme.md index 59ee85a..4bcc85f 100644 --- a/exampleSite/content/post/creating-a-new-theme.md +++ b/exampleSite/content/post/creating-a-new-theme.md @@ -671,7 +671,7 @@ $ vi themes/zafta/layouts/index.html <!DOCTYPE html> <html> <body> - {{ range first 10 .Data.Pages }} + {{ range first 10 .Site.RegularPages }} <h1>{{ .Title }}</h1> {{ end }} </body> @@ -834,7 +834,7 @@ $ vi themes/zafta/layouts/index.html <!DOCTYPE html> <html> <body> - {{ range first 10 .Data.Pages }} + {{ range first 10 .Site.RegularPages }} <h1><a href="{{ .Permalink }}">{{ .Title }}</a></h1> {{ end }} </body> @@ -952,14 +952,14 @@ $ vi themes/zafta/layouts/index.html <html> <body> <h1>posts</h1> - {{ range first 10 .Data.Pages }} + {{ range first 10 .Site.RegularPages }} {{ if eq .Type "post"}} <h2><a href="{{ .Permalink }}">{{ .Title }}</a></h2> {{ end }} {{ end }} <h1>pages</h1> - {{ range .Data.Pages }} + {{ range .Site.RegularPages }} {{ if eq .Type "page" }} <h2><a href="{{ .Permalink }}">{{ .Title }}</a></h2> {{ end }} @@ -1039,14 +1039,14 @@ $ vi themes/zafta/layouts/index.html {{ partial "header.html" . }} <h1>posts</h1> - {{ range first 10 .Data.Pages }} + {{ range first 10 .Site.RegularPages }} {{ if eq .Type "post"}} <h2><a href="{{ .Permalink }}">{{ .Title }}</a></h2> {{ end }} {{ end }} <h1>pages</h1> - {{ range .Data.Pages }} + {{ range .Site.RegularPages }} {{ if or (eq .Type "page") (eq .Type "about") }} <h2><a href="{{ .Permalink }}">{{ .Type }} - {{ .Title }} - {{ .RelPermalink }}</a></h2> {{ end }} diff --git a/layouts/index.html b/layouts/index.html index 526f8b4..db22c52 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -7,7 +7,7 @@ </section> <main class="content" role="main" id="main-content"> <h1>{{ .Site.Params.indexHeadline | default "Yay!" }}</h1> - {{ $paginator := .Paginate (where .Data.Pages.ByDate.Reverse "Type" "post") 3 }} + {{ $paginator := .Paginate (where .Site.RegularPages.ByDate.Reverse "Type" "in" site.Params.mainSections) 3 }} {{ range $paginator.Pages }} <article class="post post--preview"> <header> diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 52665cf..f5a2066 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -7,8 +7,9 @@ {{ partial "meta_opengraph.html" . }} {{ partial "meta_twittercard.html" . }} <base href="{{ .Site.BaseURL }}"> - {{ .Hugo.Generator }} <link rel="canonical" href="{{ .Permalink }}"> - {{ if .RSSLink }}<link href="{{ .RSSLink }}" rel="alternate" type="application/rss+xml" title="{{ .Title }}" />{{ end }} + {{ with .OutputFormats.Get "rss" -}} + {{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} + {{ end -}} {{ partial "head_includes.html" . }} </head> diff --git a/layouts/partials/post-list.html b/layouts/partials/post-list.html index 941ceb0..794c90f 100644 --- a/layouts/partials/post-list.html +++ b/layouts/partials/post-list.html @@ -1,4 +1,4 @@ -{{ $paginator := .Paginate (where .Data.Pages.ByDate.Reverse "Type" "post") }} +{{ $paginator := .Paginate (where .Site.RegularPages.ByDate.Reverse "Type" "post") }} {{ range $paginator.Pages }} <article class="post post--preview"> <header> |