diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index c2761c1..1d32640 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -19,7 +19,6 @@ {{ partial "head/rel-me" . }} {{ partial "head/microformats" . }} {{ partial "head/others" . }} - {{ partial "head/schema.html" . }} {{ partial "head/custom" . }} diff --git a/layouts/_default/list.atom.xml b/layouts/_default/list.atom.xml index 01d79d7..1d909dd 100644 --- a/layouts/_default/list.atom.xml +++ b/layouts/_default/list.atom.xml @@ -17,6 +17,7 @@ {{- end -}} {{- end }} {{ now.Format "2006-01-02T15:04:05-07:00" | safeHTML }} + Hugo {{ with .Site.Params.GeekblogAuthor -}} {{ with index $.Site.Data.authors . }} @@ -48,7 +49,12 @@ {{- end }} {{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }} {{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }} - {{ printf `` .Content | safeHTML }} + {{- $img := "" -}} + {{- with ($page.Resources.ByType "image").GetMatch "{*feature*,*cover*,*thumbnail*}" }} + {{- $featured := .Fill (printf "910x280 %s" (default "Smart" .Params.anchor)) -}} + {{- $img = printf `%s
` $featured.Permalink $featured.Width $featured.Height (default (partial "utils/title" $page) .Params.description) -}} + {{- end }} + {{ printf `` $img .Content | safeHTML }} {{ with .Site.Taxonomies }} {{ range $taxo,$_ := . }} {{ with $page.Param $taxo }} diff --git a/layouts/_default/list.json.json b/layouts/_default/list.json.json index af66370..d73cbc4 100644 --- a/layouts/_default/list.json.json +++ b/layouts/_default/list.json.json @@ -36,6 +36,10 @@ "date_modified" : {{ (.Lastmod.Format "2006-01-02T15:04:05Z07:00") | jsonify }}, "id" : "{{ .Permalink }}", "url" : "{{ .Permalink }}", + {{- with ($page.Resources.ByType "image").GetMatch "{*feature*,*cover*,*thumbnail*}" }} + {{- $featured := .Fill (printf "910x280 %s" (default "Smart" .Params.anchor)) -}} + "image" : "{{ $featured.Permalink }}", + {{- end }} {{- with .Params.authors -}} "authors" : [ {{- $authors := (sort .) }} diff --git a/layouts/partials/head/meta.html b/layouts/partials/head/meta.html index 5d45bfc..d6a3aad 100644 --- a/layouts/partials/head/meta.html +++ b/layouts/partials/head/meta.html @@ -3,25 +3,25 @@ {{ hugo.Generator }} -{{ $keywords := default .Site.Params.Keywords .Keywords }} -{{ $authors := default (slice .Site.Params.GeekblogAuthor) .Params.authors }} +{{- $keywords := default .Site.Params.Keywords .Keywords -}} +{{- $authors := default (slice .Site.Params.GeekblogAuthor) .Params.authors -}} -{{ with partial "utils/description" . }} +{{- with partial "utils/description" . }} -{{ end }} -{{ with $keywords }} +{{- end }} +{{- with $keywords }} -{{ end }} -{{ with $authors }} - {{ $list := slice }} - {{ range sort . }} - {{ with . }} - {{ $author := index $.Site.Data.authors . }} - {{ $list = $list | append $author.name }} - {{ end }} - {{ end }} +{{- end }} +{{- with $authors }} + {{- $list := slice -}} + {{- range sort . }} + {{- with . }} + {{- $author := index $.Site.Data.authors . -}} + {{- $list = $list | append $author.name -}} + {{- end }} + {{- end }} - {{ with $list }} + {{- with $list }} - {{ end }} -{{ end }} + {{- end }} +{{- end }} diff --git a/layouts/partials/head/microformats.html b/layouts/partials/head/microformats.html index 1e76fda..623b706 100644 --- a/layouts/partials/head/microformats.html +++ b/layouts/partials/head/microformats.html @@ -1,2 +1,3 @@ {{ partial "microformats/opengraph.html" . }} {{ partial "microformats/twitter_cards.html" . }} +{{ partial "microformats/schema.html" . }} diff --git a/layouts/partials/menu-extra.html b/layouts/partials/menu-extra.html index 7840474..4beb82a 100644 --- a/layouts/partials/menu-extra.html +++ b/layouts/partials/menu-extra.html @@ -20,11 +20,11 @@ {{ end }} {{ .name }} @@ -33,12 +33,12 @@ {{ else if eq $target "header" }}
  • {{ if $icon }} diff --git a/layouts/partials/microformats/opengraph.html b/layouts/partials/microformats/opengraph.html index b763811..5cf4a66 100644 --- a/layouts/partials/microformats/opengraph.html +++ b/layouts/partials/microformats/opengraph.html @@ -1,67 +1,74 @@ - -{{ with partial "utils/description" . }} +{{- if not (eq .Kind "home") }} + +{{- end }} +{{- with .Site.Title }} + +{{- end }} +{{- with partial "utils/description" . }} -{{ end }} +{{- end }} -{{- with $.Params.images -}} +{{- with $.Params.images }} {{- range first 6 . }}{{ end -}} -{{- else -}} - {{- $images := $.Resources.ByType "image" -}} - {{- $featured := $images.GetMatch "*feature*" -}} - {{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} - {{- with $featured -}} +{{- else }} + {{- $featured := ($.Resources.ByType "image").GetMatch "{*feature*,*cover*,*thumbnail*}" -}} + {{- with $featured }} - {{- else -}} + {{- else }} {{- with $.Site.Params.images }} - {{ end -}} - {{- end -}} -{{- end -}} + {{- end }} + {{- end }} +{{- end }} -{{- if .IsPage }} - {{- $iso8601 := "2006-01-02T15:04:05-07:00" -}} - - {{ with .PublishDate }} - - {{ end }} - {{ with .Lastmod }} - - {{ end }} -{{- end -}} - -{{- with .Params.audio }}{{ end }} -{{- with .Params.locale }}{{ end }} -{{- with .Site.Params.title }}{{ end }} +{{- with .Params.audio }} + +{{- end }} +{{- with .Params.locale }} + +{{- end }} {{- with .Params.videos }} {{- range . }} - {{ end }} - -{{ end }} + {{- end }} +{{- end }} {{- /* If it is part of a series, link to related articles */}} {{- if .Site.Taxonomies.series }} - {{- $permalink := .Permalink }} - {{- $siteSeries := .Site.Taxonomies.series }} - {{ with .Params.series }} + {{- $permalink := .Permalink -}} + {{- $siteSeries := .Site.Taxonomies.series -}} + {{- with .Params.series }} {{- range $name := . }} {{- $series := index $siteSeries ($name | urlize) }} {{- range $page := first 6 $series.Pages }} {{- if ne $page.Permalink $permalink }} - {{ end }} + {{- end }} {{- end }} - {{ end }} - {{ end }} + {{- end }} + {{- end }} +{{- end }} + +{{ if .IsPage -}} + {{- $iso8601 := "2006-01-02T15:04:05-07:00" -}} + + {{- with .PublishDate }} + + {{- end }} + {{- with .Lastmod }} + + {{- end }} {{- end }} {{- /* Facebook Page Admin ID for Domain Insights */}} -{{- with .Site.Social.facebook_admin }}{{ end }} +{{- with .Site.Social.facebook_admin }} + +{{- end }} diff --git a/layouts/partials/head/schema.html b/layouts/partials/microformats/schema.html similarity index 89% rename from layouts/partials/head/schema.html rename to layouts/partials/microformats/schema.html index e2f4ff0..dc52753 100644 --- a/layouts/partials/head/schema.html +++ b/layouts/partials/microformats/schema.html @@ -1,5 +1,5 @@ -{{ if eq .Kind "home" }} - {{ $thumbnail := default (default "brand.svg" .Site.Params.logo) (index (default slice .Site.Params.images) 0) | absURL }} +{{- if eq .Kind "home" }} + {{- $thumbnail := default (default "brand.svg" .Site.Params.logo) (index (default slice .Site.Params.images) 0) | absURL -}} -{{ else if .IsPage }} - {{ $authors := default (slice .Site.Params.GeekblogAuthor) .Params.authors }} - {{ $ac := 0 }} - {{ $ac_max := default 0 (len $authors) }} +{{- else if .IsPage }} + {{- $authors := default (slice .Site.Params.GeekblogAuthor) .Params.authors -}} + {{- $ac := 0 -}} + {{- $ac_max := default 0 (len $authors) -}} -{{- end -}} +{{- end }} diff --git a/layouts/partials/microformats/twitter_cards.html b/layouts/partials/microformats/twitter_cards.html index aadd2ab..55097be 100644 --- a/layouts/partials/microformats/twitter_cards.html +++ b/layouts/partials/microformats/twitter_cards.html @@ -1,21 +1,23 @@ {{- with $.Params.images -}} -{{ else -}} +{{- else }} {{- $images := $.Resources.ByType "image" -}} {{- $featured := $images.GetMatch "*feature*" -}} - {{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} - {{- with $featured -}} + {{- if not $featured }} + {{- $featured = $images.GetMatch "{*cover*,*thumbnail*}" -}} + {{- end }} + {{- with $featured }} - {{- else -}} - {{- with $.Site.Params.images -}} + {{- else }} + {{- with $.Site.Params.images }} - {{ else -}} + {{- else }} - {{- end -}} - {{- end -}} + {{- end }} + {{- end }} {{- end }} {{- with partial "utils/description" . }}