1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-19 04:35:31 -04:00

make absURLs more resilient (trailing slashes/not)

This commit is contained in:
2020-02-03 08:58:30 -05:00
parent af61020152
commit f19084006f
10 changed files with 17 additions and 15 deletions

View File

@@ -1,6 +1,6 @@
<!doctype html>
{{ printf "<!--\n ,,, ,,,\n ;\" ^; ;\" \",\n ; s$$$$$s ;\n , ss$$$$$$$ss ,\"\n ;$$$$$$$$$$$$$$$$\n $$$$$$$$$$$$$$$$$$ Hello, human. :)\n $$$$$\"\"\"$$$\"\"\"$$$$$$\n $$$$$ p\"$$$\"q $$$$$ %s\n $$$$ .$$$$$. $$$$\n $$$$$$$$$$$$$$$$$\n \"$$$$\"*\"$$$$\"\n \"$$.$$\"\n-->" ("humans.txt" | absURL) | safeHTML }}
<html lang="{{ with .Site.LanguageCode }}{{ . }}{{ else }}en{{ end }}">
<html lang="{{ .Site.LanguageCode | default "en" }}">
<head>
{{ partial "head/head" . }}
</head>

View File

@@ -14,7 +14,7 @@
{{ if .HasShortcode "vimeo" }}<script async custom-element="amp-gist" src="https://cdn.ampproject.org/v0/amp-vimeo-0.1.js"></script>{{ end }}
<title>{{ .Title }} &ndash; {{ .Site.Title }}</title>
{{ with .OutputFormats.Get "html" }}<link rel="canonical" href="{{ .Permalink }}">{{ end }}
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1">
<meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{ .Site.Params.description }}{{ end }}">
<meta name="author" content="{{ .Site.Author.name }}">
{{ partial "head/open-graph" . }}

View File

@@ -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 }}

View File

@@ -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" . -}}

View File

@@ -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 }}">

View File

@@ -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" }}"
}

View File

@@ -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" }}"
},