playing with Scratch to re-use image logic -- still messy but it's progress

This commit is contained in:
2019-12-21 13:17:35 -05:00
parent 762a82b3cb
commit 027725faf1
7 changed files with 47 additions and 37 deletions
+3 -11
View File
@@ -1,10 +1,4 @@
{{- with .Site.Author -}}
{{- $imagePath := "" }}
{{- with $.Site.Params.defaultimage }}
{{- $imagePath = (path.Join "content" .) }}
{{- end }}
<script type="application/ld+json">
{
"@context": "http://schema.org",
@@ -14,14 +8,12 @@
"url": {{ $.Site.BaseURL }},
"description": {{ $.Site.Params.description }},
{{ with .jobtitle }}"jobTitle": {{ . }},{{ end }}
{{- with (imageConfig $imagePath) }}
"image": {
"@type": "ImageObject",
"url": {{ replace $imagePath "content/" $.Site.BaseURL }},
"width": "{{ .Width }}",
"height": "{{ .Height }}"
"url": {{ $.Scratch.Get "defaultImage_url" }},
"width": "{{ $.Scratch.Get "defaultImage_width" }}",
"height": "{{ $.Scratch.Get "defaultImage_height" }}"
},
{{- end }}
"sameAs": [
{{ $.Site.BaseURL }},
{{ with .github }}{{ printf "%s%s" "https://github.com/" . }},{{ end }}