1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-21 07:41:18 -04:00

change a BUNCH of if's to with's to prepare for theme extraction

This commit is contained in:
2019-12-03 12:41:55 -05:00
parent ac0bbc6343
commit 96ad258d36
23 changed files with 153 additions and 104 deletions

View File

@@ -1,5 +1,7 @@
{{- $imagePath := "content/me_large.jpg" -}}
{{- if .Params.image }}{{ $imagePath = (printf "%s%s%s%s" "content" (.OutputFormats.Get "html").RelPermalink "images/" .Params.image ) }}{{ end -}}
{{- $imagePath := "" }}
{{- with .Params.image }}
{{- $imagePath = (printf "%s%s%s%s" "content" ($.OutputFormats.Get "html").RelPermalink "images/" .) }}
{{- end }}
{{- $image := resources.Get $imagePath -}}
<script type="application/ld+json">
@@ -13,14 +15,14 @@
"datePublished": {{ .PublishDate.Format "2006-01-02T15:04:05-07:00" }},
"dateModified": {{ .PublishDate.Format "2006-01-02T15:04:05-07:00" }},
"keywords": {{ with .Params.tags }}{{ delimit . ", " }}{{ end }},
"description": {{ if .Description }}{{ .Description }}{{ else }}{{ .Site.Params.description }}{{ end }},
"description": {{ with .Description }}{{ . }}{{ else }}{{ .Site.Params.description }}{{ end }},
"wordCount": "{{ .WordCount }}",
"author": {
"@id": "https://jarv.is/#author"
"@id": {{ printf "%s%s" .Site.BaseURL "#author" }}
},
"publisher": {
"@type": "Organization",
"name": {{ .Site.Author.name }},
"name": {{ .Site.Title }},
"url": {{ .Site.BaseURL }},
"logo": {
"@type": "ImageObject",
@@ -28,12 +30,13 @@
"width": "2048",
"height": "2048"
}
},
}{{ with $image }},
"image": {
"@type": "ImageObject",
"url": {{ if .Params.image }}{{ (printf "%s%s%s" (.OutputFormats.Get "html").Permalink "images/" .Params.image ) }}{{ else }}{{ "me_large.jpg" | absURL }}{{ end }},
"width": "{{ $image.Width }}",
"height": "{{ $image.Height }}"
"url": {{ replace .Permalink "/content/" "/" }},
"width": "{{ .Width }}",
"height": "{{ .Height }}"
}
{{- end }}
}
</script>