diff options
author | parsiya@gmail.com <parsiya@gmail.com> | 2016-05-27 05:09:08 +0300 |
---|---|---|
committer | parsiya@gmail.com <parsiya@gmail.com> | 2016-05-27 05:09:08 +0300 |
commit | 61ec7259110f7ea75a082a40d3f7fb0e5cce70e0 (patch) | |
tree | 37baba4a717dc1ebbf2720b02fdb2c29ec2540f1 | |
parent | 22fb9360181920ff5a4e05ead072c4fba3116109 (diff) |
Fix homepage detection according to Erethon's suggestion using scratch variables
-rw-r--r-- | layouts/index.html | 3 | ||||
-rw-r--r-- | layouts/partials/post_header.html | 2 | ||||
-rw-r--r-- | layouts/post/single.html | 1 |
3 files changed, 4 insertions, 2 deletions
diff --git a/layouts/index.html b/layouts/index.html index c44ebf9..591dbe6 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -7,6 +7,7 @@ {{ range $paginator.Pages }} <article> + {{ .Scratch.Set "isHome" true }} {{ partial "post_header.html" . }} {{ if eq .Site.Params.truncate false }} @@ -30,7 +31,7 @@ </article> {{ end }} <!-- {{ template "_internal/pagination.html" . }} default pagination --> - {{ partial "pagination.html" . }} <!-- use custom pagination --> + {{ partial "pagination.html" . }} <!-- use custom pagination --> </div> diff --git a/layouts/partials/post_header.html b/layouts/partials/post_header.html index b65d6cb..4c64bfc 100644 --- a/layouts/partials/post_header.html +++ b/layouts/partials/post_header.html @@ -2,7 +2,7 @@ <header> <h1 class="entry-title"> - {{ if .IsHome }} <a href="{{ .Permalink }}">{{ .Title }}</a> {{ else }} {{ .Title }} {{ end }} + {{ if ($.Scratch.Get "isHome") }}<a href="{{ .Permalink }}">{{ .Title }}</a>{{ else }} {{ .Title }} {{ end }} </h1> <p class="meta">{{ .Date.Format "Jan 2, 2006" }} {{ if not .Site.Params.disableReadingTime }} - {{ .ReadingTime }} minute read {{ end }} diff --git a/layouts/post/single.html b/layouts/post/single.html index d61ba0d..6e4de67 100644 --- a/layouts/post/single.html +++ b/layouts/post/single.html @@ -5,6 +5,7 @@ <div> <article class="hentry" role="article"> + {{ .Scratch.Set "isHome" false }} {{ partial "post_header.html" . }} <div class="entry-content"> |