From a4521932688998713b8894175c62c795d79188f3 Mon Sep 17 00:00:00 2001 From: Matt Stratton Date: Tue, 31 Jan 2017 06:03:57 -0600 Subject: [PATCH 1/2] Fix some extra whitespace Signed-off-by: Matt Stratton --- layouts/index.html | 46 +++++++++++------------ layouts/partials/head.html | 16 ++++++-- layouts/partials/head/seo.html | 4 +- layouts/partials/head/seo/open_graph.html | 40 ++++++++------------ layouts/partials/head/seo/schema.html | 8 ++-- layouts/partials/meta.html | 2 +- 6 files changed, 58 insertions(+), 58 deletions(-) diff --git a/layouts/index.html b/layouts/index.html index 380f17cb6..a53a3e783 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -9,9 +9,9 @@ {{ $.Scratch.Add "i" 1 }}
- {{ range sort $.Site.Data.events "startdate" }} - {{ if .startdate }} - {{ if ge (dateFormat "2006-01-02" .startdate) (dateFormat "2006-01-02" ($.Now.Format "2006-01-02")) }} + {{- range sort $.Site.Data.events "startdate" -}} + {{- if .startdate -}} + {{- if ge (dateFormat "2006-01-02" .startdate) (dateFormat "2006-01-02" ($.Now.Format "2006-01-02")) -}} {{ $.Scratch.Set "city" .city }} {{ $.Scratch.Set "year" .year }} {{ $.Scratch.Set "logo" "unset" }} @@ -19,19 +19,19 @@ {{ $.Scratch.Set "subdir" .name }} {{ $.Scratch.Set "contentdir" (printf "static/events/%s/" ($.Scratch.Get "subdir")) }} - {{ range (readDir "static/events") }} - {{ if eq .Name ($.Scratch.Get "subdir") }} - {{ range (readDir ($.Scratch.Get "contentdir"))}} - {{ if eq .Name "logo-square.png" }} + {{- range (readDir "static/events") -}} + {{- if eq .Name ($.Scratch.Get "subdir") -}} + {{- range (readDir ($.Scratch.Get "contentdir")) -}} + {{- if eq .Name "logo-square.png" -}} {{ $.Scratch.Set "logo" "set" }} - {{ end }} - {{ end }} - {{ end }} - {{ end }} - {{ if ne ($.Scratch.Get "logo") "set" }} + {{- end -}} + {{- end -}} + {{- end -}} + {{- end -}} + {{- if ne ($.Scratch.Get "logo") "set" -}} - {{ end }} + {{- end -}}
@@ -41,19 +41,19 @@ {{ .city }}
- {{ if .description }} - {{ if ne .description "" }} + {{- if .description -}} + {{- if ne .description "" -}} {{ .description | markdownify }} - {{ end }} - {{ end }} + {{- end -}} + {{- end -}}
- {{ if modBool ($.Scratch.Get "i") 4 }} + {{- if modBool ($.Scratch.Get "i") 4 -}}
- {{ end }} + {{- end -}} {{ $.Scratch.Add "i" 1 }} - {{ end }} - {{ end }} - {{ end }} + {{- end -}} + {{- end -}} + {{- end -}}
-{{ end }} +{{- end -}} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 23c7775ae..abb5ba52d 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -1,10 +1,20 @@ {{ .Hugo.Generator }} -{{- partial "meta.html" . -}} +{{ partial "meta.html" . }} {{ partial "head/seo.html" . }} + - {{ $url := replace .Permalink ( printf "%s" .Site.BaseURL) "" }} {{ if eq $url "/" }} {{ .Site.Title }} {{ else }} {{ if .Params.Heading }} {{ .Params.Heading }} {{ else }} {{ .Title }} {{ end }} {{ end }} + {{- $url := replace .Permalink ( printf "%s" .Site.BaseURL) "" -}} + {{- if eq $url "/" -}} + {{ .Site.Title }} + {{- else -}} + {{- if .Params.Heading -}} + {{ .Params.Heading }} + {{- else -}} + {{ .Title }} + {{- end -}} + {{- end -}} -{{- partial "head_includes.html" . -}} +{{ partial "head_includes.html" . }} diff --git a/layouts/partials/head/seo.html b/layouts/partials/head/seo.html index 4e3ae562a..1c128b92a 100644 --- a/layouts/partials/head/seo.html +++ b/layouts/partials/head/seo.html @@ -1,2 +1,2 @@ -{{ partial "head/seo/open_graph.html" . }} -{{ partial "head/seo/schema.html" . }} +{{- partial "head/seo/open_graph.html" . -}} +{{- partial "head/seo/schema.html" . -}} diff --git a/layouts/partials/head/seo/open_graph.html b/layouts/partials/head/seo/open_graph.html index ac02ac9f4..101129a1b 100644 --- a/layouts/partials/head/seo/open_graph.html +++ b/layouts/partials/head/seo/open_graph.html @@ -3,43 +3,33 @@ -{{ with .Params.images }}{{ range first 1 . }} +{{- with .Params.images -}}{{- range first 1 . -}} -{{ end }}{{ end }} +{{- end -}}{{- end -}} -{{ with .Params.audio }}{{ end }} -{{ with .Params.locale }}{{ end }} -{{ with .Site.Params.title }}{{ end }} -{{ with .Params.videos }}{{ range . }} +{{- with .Params.audio -}}{{- end -}} +{{- with .Params.locale -}}{{- end -}} +{{- with .Site.Params.title -}}{{- end -}} +{{- with .Params.videos -}}{{- range . -}} -{{ end }}{{ end }} +{{- end -}}{{- end -}} - -{{ $permalink := .Permalink }} -{{ $siteSeries := .Site.Taxonomies.series }} -{{ with .Params.series }}{{ range $name := . }} - {{ $series := index $siteSeries $name }} - {{ range $page := first 6 $series.Pages }} - {{ if ne $page.Permalink $permalink }}{{ end }} - {{ end }} -{{ end }}{{ end }} - -{{ if and (isset .Site.Params "authors") (isset .Params "author") }} +{{- if and (isset .Site.Params "authors") (isset .Params "author") -}} -{{ $author := index .Site.Params.authors .Params.author }} +{{- $author := index .Site.Params.authors .Params.author -}} -{{ end }} +{{- end -}} -{{if .IsPage}} +{{- if .IsPage -}} -{{ end }} +{{- end -}} -{{ with .Params.tags }}{{ range first 6 . }} +{{- with .Params.tags -}}{{- range first 6 . -}} -{{ end }}{{ end }} +{{- end -}}{{- end -}} -{{ with .Site.Params.social.facebook_admin }}{{ end }} +{{- with .Site.Params.social.facebook_admin -}}{{- end -}} diff --git a/layouts/partials/head/seo/schema.html b/layouts/partials/head/seo/schema.html index e34883417..2fd5a0bce 100644 --- a/layouts/partials/head/seo/schema.html +++ b/layouts/partials/head/seo/schema.html @@ -3,13 +3,13 @@ -{{ with .Params.images }}{{ range first 6 . }} +{{- with .Params.images -}}{{- range first 6 . -}} -{{ end }}{{ end }} +{{- end -}}{{- end -}} -{{if .IsPage}} +{{- if .IsPage -}} -{{ end }} \ No newline at end of file +{{- end -}} diff --git a/layouts/partials/meta.html b/layouts/partials/meta.html index acb48cf12..9e984eca4 100644 --- a/layouts/partials/meta.html +++ b/layouts/partials/meta.html @@ -3,4 +3,4 @@ -{{ if .Site.Params.Description }}{{ end }} +{{- if .Site.Params.Description -}}{{- end -}} From d52a09918589657a2a566252ec72acb14983b0cb Mon Sep 17 00:00:00 2001 From: Matt Stratton Date: Tue, 31 Jan 2017 06:09:48 -0600 Subject: [PATCH 2/2] Only load map array on homepage Signed-off-by: Matt Stratton --- layouts/partials/footer_scripts.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/layouts/partials/footer_scripts.html b/layouts/partials/footer_scripts.html index d588f9bfe..8d7022b7d 100644 --- a/layouts/partials/footer_scripts.html +++ b/layouts/partials/footer_scripts.html @@ -1,5 +1,6 @@ -{{ partial "map.html" . }} - +{{ if .IsHome }} + {{ partial "map.html" . }} +{{ end }}