mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-07-19 12:35:31 -04:00
make absURLs more resilient (trailing slashes/not)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{{/* Default image */}}
|
||||
{{- $defaultImagePath := (path.Join "content" $.Site.Params.defaultimage) }}
|
||||
{{ $.Scratch.Set "defaultImage_url" (replace $defaultImagePath "content/" $.Site.BaseURL) }}
|
||||
{{ $.Scratch.Set "defaultImage_url" (replace $defaultImagePath "content/" "") }}
|
||||
{{ with (imageConfig $defaultImagePath) }}
|
||||
{{- $.Scratch.Set "defaultImage_width" .Width }}
|
||||
{{- $.Scratch.Set "defaultImage_height" .Height }}
|
||||
@@ -10,13 +10,13 @@
|
||||
{{- with .Params.image }}
|
||||
{{- $imagePath := (path.Join "content" $.File.Dir "images/" .) }}
|
||||
|
||||
{{- $.Scratch.Set "socialImage_url" (replace $imagePath "content/" $.Site.BaseURL) }}
|
||||
{{- $.Scratch.Set "socialImage_url" (replace $imagePath "content/" "") }}
|
||||
{{- with (imageConfig $imagePath) }}
|
||||
{{- $.Scratch.Set "socialImage_width" .Width }}
|
||||
{{- $.Scratch.Set "socialImage_height" .Height }}
|
||||
{{- end }}
|
||||
{{ else }}
|
||||
{{- $.Scratch.Set "socialImage_url" (replace $defaultImagePath "content/" $.Site.BaseURL) }}
|
||||
{{- $.Scratch.Set "socialImage_url" (replace $defaultImagePath "content/" "") }}
|
||||
{{- with (imageConfig $defaultImagePath) }}
|
||||
{{- $.Scratch.Set "socialImage_width" .Width }}
|
||||
{{- $.Scratch.Set "socialImage_height" .Height }}
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
{{/* Site logo */}}
|
||||
{{- $logoImagePath := (path.Join "content" "logo.png") }}
|
||||
{{ $.Scratch.Set "logoImage_url" (replace $logoImagePath "content/" $.Site.BaseURL) }}
|
||||
{{ $.Scratch.Set "logoImage_url" (replace $logoImagePath "content/" "") }}
|
||||
{{ with (imageConfig $logoImagePath) }}
|
||||
{{- $.Scratch.Set "logoImage_width" .Width }}
|
||||
{{- $.Scratch.Set "logoImage_height" .Height }}
|
@@ -1,5 +1,5 @@
|
||||
{{ partial "head/meta" . -}}
|
||||
{{ partial "head/social-images" . -}}
|
||||
{{ partial "functions/social-images" . -}}
|
||||
{{ partial "head/open-graph" . -}}
|
||||
{{ partialCached "head/mobile" . -}}
|
||||
{{ partialCached "head/preload" . -}}
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<meta property="og:url" content="{{ .Permalink }}">
|
||||
<meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{ .Site.Params.description }}{{ end }}">
|
||||
|
||||
<meta property="og:image" content="{{ .Scratch.Get "socialImage_url" }}">
|
||||
<meta property="og:image" content="{{ .Scratch.Get "socialImage_url" | absURL }}">
|
||||
<meta property="og:image:width" content="{{ .Scratch.Get "socialImage_width" }}">
|
||||
<meta property="og:image:height" content="{{ .Scratch.Get "socialImage_height" }}">
|
||||
<meta property="og:image:alt" content="{{ .Title }}">
|
||||
|
@@ -12,7 +12,7 @@
|
||||
"description": {{ with .Description }}{{ . }}{{ else }}{{ .Site.Params.description }}{{ end }},
|
||||
"wordCount": "{{ .WordCount }}",
|
||||
"author": {
|
||||
"@id": {{ printf "%s%s" .Site.BaseURL "#author" }}
|
||||
"@id": {{ path.Join $.Site.BaseURL "#author" }}
|
||||
},
|
||||
"publisher": {
|
||||
"@type": "Organization",
|
||||
@@ -20,14 +20,14 @@
|
||||
"url": {{ .Site.BaseURL }},
|
||||
"logo": {
|
||||
"@type": "ImageObject",
|
||||
"url": {{ .Scratch.Get "logoImage_url" }},
|
||||
"url": {{ .Scratch.Get "logoImage_url" | absURL }},
|
||||
"width": "{{ .Scratch.Get "logoImage_width" }}",
|
||||
"height": "{{ .Scratch.Get "logoImage_height" }}"
|
||||
}
|
||||
},
|
||||
"image": {
|
||||
"@type": "ImageObject",
|
||||
"url": {{ .Scratch.Get "socialImage_url" }},
|
||||
"url": {{ .Scratch.Get "socialImage_url" | absURL }},
|
||||
"width": "{{ .Scratch.Get "socialImage_width" }}",
|
||||
"height": "{{ .Scratch.Get "socialImage_height" }}"
|
||||
}
|
||||
|
@@ -3,14 +3,14 @@
|
||||
{
|
||||
"@context": "http://schema.org",
|
||||
"@type": "Person",
|
||||
"@id": {{ printf "%s%s" $.Site.BaseURL "#author" }},
|
||||
"@id": {{ path.Join $.Site.BaseURL "#author" }},
|
||||
"name": {{ $.Site.Author.name }},
|
||||
"url": {{ $.Site.BaseURL }},
|
||||
"description": {{ $.Site.Params.description }},
|
||||
{{ with .jobtitle }}"jobTitle": {{ . }},{{ end }}
|
||||
"image": {
|
||||
"@type": "ImageObject",
|
||||
"url": {{ $.Scratch.Get "defaultImage_url" }},
|
||||
"url": {{ $.Scratch.Get "defaultImage_url" | absURL }},
|
||||
"width": "{{ $.Scratch.Get "defaultImage_width" }}",
|
||||
"height": "{{ $.Scratch.Get "defaultImage_height" }}"
|
||||
},
|
||||
|
Reference in New Issue
Block a user