Add QR code preview support

QR codes can now be generated for all pages with the post processing script
the HEAD of all the html now has an open graph image tage pointing to the QR code url
This commit is contained in:
Oliver Atkinson 2024-07-10 10:44:05 -06:00
parent 63d510e077
commit ed3428e164
2 changed files with 9 additions and 1 deletions

View File

@ -14,7 +14,8 @@
<meta property="og:description" content="{{ with .Params.description }}{{ . }}{{ else }}{{ .Summary }}{{ end }}"> <meta property="og:description" content="{{ with .Params.description }}{{ . }}{{ else }}{{ .Summary }}{{ end }}">
<meta property="og:type" content='{{ if .IsHome }}{{ "website" }}{{ else }}{{ "article" }}{{ end }}'> <meta property="og:type" content='{{ if .IsHome }}{{ "website" }}{{ else }}{{ "article" }}{{ end }}'>
<meta property="og:locale" content="{{ .Site.LanguageCode }}"> <meta property="og:locale" content="{{ .Site.LanguageCode }}">
<meta property="og:image" content="<page-image-url>"> <meta property="og:url" content="{{ .Page.Permalink }}">
<meta property="og:image" content="{{ .Page.Permalink }}qr.png">
{{ if isset .Params "tags" }} {{ if isset .Params "tags" }}
<meta name="keywords" content="{{ with .Params.tags }}{{ delimit . " , " }}{{ end }}"> <meta name="keywords" content="{{ with .Params.tags }}{{ delimit . " , " }}{{ end }}">
{{ end -}} {{ end -}}

7
post-process.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
cd public/
find -name *.html | while read FILE; do
URL="$(grep -oP '(?<="og:url" content=")(.*)(?=")' $FILE)"
qrencode $URL -o $(dirname $FILE)/qr.png
done