1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-19 15:25: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

2
.gitignore vendored
View File

@@ -2,6 +2,8 @@ public/
builds/
resources/
.env
node_modules/
package-lock.json
yarn-debug.log

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

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

View File

@@ -36,7 +36,7 @@
"cross-env": "^7.0.0",
"get-folder-size": "^2.0.1",
"html-minifier": "^4.0.0",
"hugo-extended": "git+https://github.com/jakejarvis/hugo-extended.git#master",
"hugo-extended": "git+https://github.com/jakejarvis/hugo-extended.git",
"imagemin-cli": "^5.1.0",
"imagemin-gifsicle": "^7.0.0",
"imagemin-jpegoptim": "^6.0.0",

View File

@@ -2310,7 +2310,7 @@ https-proxy-agent@^4.0.0:
agent-base "5"
debug "4"
"hugo-extended@git+https://github.com/jakejarvis/hugo-extended.git#master":
"hugo-extended@git+https://github.com/jakejarvis/hugo-extended.git":
version "0.63.2"
resolved "git+https://github.com/jakejarvis/hugo-extended.git#f6b20c2deeabdc9d45f49ee9cfa3f8d7c704737a"
dependencies: