diff --git a/layouts/partials/head/meta.html b/layouts/partials/head/meta.html
index 044c101..a6dc43d 100644
--- a/layouts/partials/head/meta.html
+++ b/layouts/partials/head/meta.html
@@ -7,7 +7,7 @@
{{- $authors := default (slice .Site.Params.GeekblogAuthor) .Params.authors -}}
{{- with partial "utils/description" . }}
-
+
{{- end }}
{{- with $keywords }}
diff --git a/layouts/partials/microformats/opengraph.html b/layouts/partials/microformats/opengraph.html
index bd4b5a9..248163d 100644
--- a/layouts/partials/microformats/opengraph.html
+++ b/layouts/partials/microformats/opengraph.html
@@ -4,25 +4,14 @@
{{- with .Site.Title }}
{{- end }}
+{{- with partial "utils/featured" . }}
+
+{{- end }}
{{- with partial "utils/description" . }}
-
+
{{- end }}
-
-{{- with $.Params.images }}
- {{- range first 6 . }}{{ end -}}
-{{- else }}
- {{- $featured := ($.Resources.ByType "image").GetMatch "{*feature*,*cover*,*thumbnail*}" -}}
- {{- with $featured }}
-
- {{- else }}
- {{- with $.Site.Params.images }}
-
- {{- end }}
- {{- end }}
-{{- end }}
-
{{- with .Params.audio }}
{{- end }}
diff --git a/layouts/partials/microformats/schema.html b/layouts/partials/microformats/schema.html
index b9206fa..5467e63 100644
--- a/layouts/partials/microformats/schema.html
+++ b/layouts/partials/microformats/schema.html
@@ -1,6 +1,4 @@
{{- if eq .Kind "home" }}
- {{- $thumbnail := default (default "brand.svg" .Site.Params.logo) (index (default slice .Site.Params.images) 0) | absURL -}}
-
{{- else if .IsPage }}
@@ -30,19 +31,30 @@
"@type": "BlogPosting",
"articleSection": "{{ .Section | humanize | title }}",
"name": "{{ (partial "utils/title" .) | safeJS }}",
+ "url" : {{ .Permalink | jsonify | safeJS }},
"headline": "{{ (partial "utils/title" .) | safeJS }}",
{{- with .Params.lead }}
"alternativeHeadline": "{{ . }}",
{{- end }}
{{- with partial "utils/description" . }}
- "description": "{{ trim (. | plainify) "\n" | safeHTML }}",
+ "description": {{ trim (. | plainify) "\n" | jsonify | safeJS }},
{{- end }}
- "inLanguage": {{ .Site.Language.Lang }},
+ {{- with partial "utils/featured" . }}
+ "thumbnailUrl": {{ . | jsonify | safeJS }},
+ {{- end }}
+ "wordCount" : "{{ .WordCount }}",
+ {{- with .Site.Params.GeekblogContentLicense }}
+ "license": "{{ .name }}",
+ {{- end }}
+ "inLanguage": {{ .Lang }},
"isFamilyFriendly": "true",
"mainEntityOfPage": {
"@type": "WebPage",
- "@id": "{{ .Permalink }}"
+ "@id": {{ .Permalink | jsonify | safeJS }}
},
+ {{- with $tags := .Params.tags }}
+ "keywords" : [ {{ range $i, $tag := $tags }}{{ if $i }}, {{ end }}"{{ $tag }}" {{ end }}],
+ {{- end }}
{{- with $authors }}
"author" : [
{{- range sort . }}
@@ -65,26 +77,14 @@
"publisher":{
"@type":"Organization",
"name": {{ .Site.Title }},
- "url": {{ .Site.BaseURL }},
+ "url": {{ .Site.BaseURL | jsonify | safeJS }},
"logo": {
"@type": "ImageObject",
- "url": "{{ (default "brand.svg" .Site.Params.logo) | absURL }}",
+ "url": {{ (default "brand.svg" .Site.Params.logo) | absURL | jsonify | safeJS }},
"width":"32",
"height":"32"
}
- },
- {{- with $images := $.Resources.ByType "image" }}
- "image": [ {{ range $i, $image := $images }}{{ if $i }}, {{ end }}"{{ $image.Permalink | absURL }}" {{ end }}],
- {{- else }}
- {{- with $images := .Params.images }}
- "image": [ {{ range $i, $image := $images }}{{ if $i }}, {{ end }}"{{ $image | absURL }}" {{ end }}],
- {{- end }}
- {{- end }}
- "url" : "{{ .Permalink }}",
- "wordCount" : "{{ .WordCount }}",
- {{- with $tags := .Params.tags }}
- "genre" : [ {{ range $i, $tag := $tags }}{{ if $i }}, {{ end }}"{{ $tag }}" {{ end }}]
- {{- end }}
+ }
}
{{- end }}
diff --git a/layouts/partials/microformats/twitter_cards.html b/layouts/partials/microformats/twitter_cards.html
index 86f96d4..e832a8d 100644
--- a/layouts/partials/microformats/twitter_cards.html
+++ b/layouts/partials/microformats/twitter_cards.html
@@ -1,27 +1,14 @@
-{{- with $.Params.images -}}
+{{- with partial "utils/featured" . }}
-
{{- else }}
- {{- $images := $.Resources.ByType "image" -}}
- {{- $featured := $images.GetMatch "*feature*" -}}
- {{- if not $featured }}
- {{- $featured = $images.GetMatch "{*cover*,*thumbnail*}" -}}
- {{- end }}
- {{- with $featured }}
-
-
- {{- else }}
- {{- with $.Site.Params.images }}
-
-
- {{- else }}
-
- {{- end }}
- {{- end }}
+
{{- end }}
+{{- with partial "utils/featured" . }}
+
+{{- end }}
{{- with partial "utils/description" . }}
-
+
{{- end }}
{{- with .Site.Social.twitter -}}
diff --git a/layouts/partials/utils/featured.html b/layouts/partials/utils/featured.html
new file mode 100644
index 0000000..33c4be8
--- /dev/null
+++ b/layouts/partials/utils/featured.html
@@ -0,0 +1,12 @@
+{{ $img := "" }}
+
+{{ with $source := ($.Resources.ByType "image").GetMatch "{*feature*,*cover*,*thumbnail*}" }}
+ {{ $featured := .Fill (printf "1200x630 %s" (default "Smart" .Params.anchor)) }}
+ {{ $img = $featured.Permalink }}
+{{ else }}
+ {{ with default $.Site.Params.images $.Params.images }}
+ {{ $img = index . 0 | absURL }}
+ {{ end }}
+{{ end }}
+
+{{ return $img }}