From ace158ed4298b8045aabd6f33eb421e086f8a2e7 Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Mon, 17 Jan 2022 15:56:08 +1100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=8D=20Add=20more=20detail=20to=20JSON-?= =?UTF-8?q?LD=20structured=20data?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 +- layouts/partials/schema.html | 63 ++++++++++++++++++++++++++++-------- 2 files changed, 51 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c8a7669a..350d9613 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,12 +19,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Changed -- Upgrade to Tailwind v3.0.13 +- Upgrade to Tailwind v3.0.15 - Upgrade to KaTeX v0.15.2 - Inline Javascript moved to external files - Author images are now Hugo assets - Required Hugo version is now 0.87.0 or later - Overhauled `figure` shortcode which now resizes images +- Improved JSON-LD structured data - Minor style and layout improvements ## [1.6.2] - 2022-01-07 diff --git a/layouts/partials/schema.html b/layouts/partials/schema.html index 6cf9c774..d21d4e60 100644 --- a/layouts/partials/schema.html +++ b/layouts/partials/schema.html @@ -3,38 +3,73 @@ { "@context": "https://schema.org", "@type": "WebSite", + "@id": "{{ (site.GetPage "/").Permalink | safeURL }}", "name": "{{ .Site.Title | safeJS }}", + {{ with .Site.Params.description }}"description": "{{ . | safeJS }}",{{ end }} + {{ with .Site.LanguageCode }}"inLanguage": "{{ . }}",{{ end }} "url": "{{ (site.GetPage "/").Permalink | safeURL }}", - "description": "{{ .Site.Params.description | safeJS }}" + "publisher" : { + "@type": "Person", + "name": "{{ .Site.Author.name | safeJS }}", + }, + {{ with .Site.Params.keywords }}"keywords": {{ . }},{{ end }} } {{ else if .IsPage }} {{- $iso8601 := "2006-01-02T15:04:05-07:00" -}} + {{ $url := replace .Permalink ( printf "%s" .Site.BaseURL) "" }} + {{ $.Scratch.Delete "path" }} + {{ $.Scratch.Add "path" .Site.BaseURL }} + {{ $count := len (split $url "/") }} {{ end }}