|
1 | | -{{- $description := or .Params.description .Site.Params.siteDescription | plainify | htmlUnescape -}} |
2 | | -{{- $data := dict |
3 | | - "@context" "https://schema.org" |
| 1 | +{{- $siteUrl := strings.TrimSuffix "/" .Site.BaseURL -}} |
| 2 | +{{- $pageUrl := .Permalink -}} |
| 3 | +{{- $title := partial "docs/html-head-title" . -}} |
| 4 | +{{- $description := or .Params.description .Description .Summary .Site.Params.siteDescription | plainify | htmlUnescape -}} |
| 5 | +{{- $inLanguage := or .Site.Language.LanguageCode .Site.Language.Lang -}} |
| 6 | +{{- $authorName := .Site.Params.authorName | default "Kai Dröge" -}} |
| 7 | +{{- $authorUrl := .Site.Params.authorUrl -}} |
| 8 | +{{- $authorSameAs := .Site.Params.authorSameAs -}} |
| 9 | +{{- $codeRepository := .Site.Params.codeRepository -}} |
| 10 | +{{- $licenseUrl := .Site.Params.licenseUrl -}} |
| 11 | + |
| 12 | +{{- $personId := printf "%s/#person" $siteUrl -}} |
| 13 | +{{- $websiteId := printf "%s/#website" $siteUrl -}} |
| 14 | +{{- $softwareId := printf "%s/#software" $siteUrl -}} |
| 15 | +{{- $webpageId := printf "%s/#webpage" (strings.TrimSuffix "/" $pageUrl) -}} |
| 16 | + |
| 17 | +{{- $person := dict "@type" "Person" "@id" $personId "name" $authorName -}} |
| 18 | +{{- with $authorUrl -}} |
| 19 | + {{- $person = merge $person (dict "url" .) -}} |
| 20 | +{{- end -}} |
| 21 | +{{- if $authorSameAs -}} |
| 22 | + {{- $person = merge $person (dict "sameAs" $authorSameAs) -}} |
| 23 | +{{- end -}} |
| 24 | + |
| 25 | +{{- $website := dict |
| 26 | + "@type" "WebSite" |
| 27 | + "@id" $websiteId |
| 28 | + "url" $siteUrl |
| 29 | + "name" .Site.Title |
| 30 | + "publisher" (dict "@id" $personId) |
| 31 | + "inLanguage" $inLanguage |
| 32 | +-}} |
| 33 | + |
| 34 | +{{- $webpage := dict |
| 35 | + "@type" "WebPage" |
| 36 | + "@id" $webpageId |
| 37 | + "url" $pageUrl |
| 38 | + "name" $title |
| 39 | + "isPartOf" (dict "@id" $websiteId) |
| 40 | + "inLanguage" $inLanguage |
| 41 | +-}} |
| 42 | +{{- if .IsHome -}} |
| 43 | + {{- $webpage = merge $webpage (dict "mainEntity" (dict "@id" $softwareId)) -}} |
| 44 | +{{- end -}} |
| 45 | + |
| 46 | +{{- $software := dict |
4 | 47 | "@type" "SoftwareApplication" |
| 48 | + "@id" $softwareId |
5 | 49 | "name" "noScribe" |
6 | 50 | "description" $description |
7 | 51 | "applicationCategory" "MultimediaApplication" |
8 | 52 | "operatingSystem" (slice "Windows" "macOS" "Linux") |
9 | 53 | "offers" (dict "@type" "Offer" "price" "0" "priceCurrency" "EUR" "availability" "https://schema.org/InStock") |
10 | | - "license" "GPL-3.0" |
11 | 54 | "isAccessibleForFree" true |
12 | | - "codeRepository" "https://github.com/kaixxx/noScribe" |
13 | | - "author" (dict "@type" "Person" "name" "Kai Dröge" "url" "https://github.com/kaixxx") |
14 | | - "sameAs" (slice "https://github.com/kaixxx") |
15 | | - "url" .Site.BaseURL |
16 | | - "inLanguage" (or .Site.Language.LanguageCode .Site.Language.Lang) |
| 55 | + "author" (dict "@id" $personId) |
| 56 | + "publisher" (dict "@id" $personId) |
| 57 | + "url" $siteUrl |
| 58 | + "inLanguage" $inLanguage |
17 | 59 | -}} |
18 | | -<script type="application/ld+json">{{ $data | jsonify }}</script> |
| 60 | +{{- with $codeRepository -}} |
| 61 | + {{- $software = merge $software (dict "codeRepository" .) -}} |
| 62 | +{{- end -}} |
| 63 | +{{- with $licenseUrl -}} |
| 64 | + {{- $software = merge $software (dict "license" .) -}} |
| 65 | +{{- end -}} |
| 66 | + |
| 67 | +{{- $graph := slice $person $website $webpage -}} |
| 68 | +{{- if .IsHome -}} |
| 69 | + {{- $graph = $graph | append $software -}} |
| 70 | +{{- end -}} |
| 71 | +{{- $data := dict "@context" "https://schema.org" "@graph" $graph -}} |
| 72 | +{{- $json := $data | jsonify (dict "noHTMLEscape" true) -}} |
| 73 | +<script type="application/ld+json">{{ $json | safeJS }}</script> |
0 commit comments