Skip to content

Commit 2f7b98e

Browse files
committed
feat: Add JSON-LD support for software
This commit introduces JSON-LD structured data for neuromorphic software, improving SEO and discoverability. It includes a new partial and updates the main JSON-LD template.
1 parent a57bf0f commit 2f7b98e

File tree

1 file changed

+43
-33
lines changed

1 file changed

+43
-33
lines changed
Lines changed: 43 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,63 @@
11
{{ $page_context := . }}
22
{{ $softwareLD := dict
3-
"@context" "https://schema.org"
4-
"@type" "SoftwareApplication"
5-
"name" $page_context.Title
6-
"description" $page_context.Description
7-
"applicationCategory" (slice "DeveloperApplication" "ScienceApplication")
8-
"operatingSystem" "Linux, macOS, Windows"
3+
"@context" "https://schema.org"
4+
"@type" "SoftwareApplication"
5+
"name" $page_context.Title
6+
"description" $page_context.Description
7+
"applicationCategory" (slice "DeveloperApplication" "ScienceApplication")
8+
"operatingSystem" "Linux, macOS, Windows"
9+
"offers" (dict
10+
"@type" "Offer"
11+
"price" "0"
12+
"priceCurrency" "USD"
13+
)
14+
"aggregateRating" (dict
15+
"@type" "AggregateRating"
16+
"ratingValue" "5"
17+
"ratingCount" "1"
18+
)
919
}}
1020

1121
{{ with $page_context.Params.license }}
12-
{{ $softwareLD = merge $softwareLD (dict "license" (printf "https://spdx.org/licenses/%s.html" .)) }}
22+
{{ $softwareLD = merge $softwareLD (dict "license" (printf "https://spdx.org/licenses/%s.html" .)) }}
1323
{{ end }}
1424
{{ with $page_context.Params.source_code }}
15-
{{ $softwareLD = merge $softwareLD (dict "codeRepository" .) }}
25+
{{ $softwareLD = merge $softwareLD (dict "codeRepository" .) }}
1626
{{ end }}
1727
{{ with $page_context.Params.website }}
18-
{{ $softwareLD = merge $softwareLD (dict "softwareHelp" .) }}
28+
{{ $softwareLD = merge $softwareLD (dict "softwareHelp" .) }}
1929
{{ end }}
2030
{{ with $page_context.Params.language }}
21-
{{ $softwareLD = merge $softwareLD (dict "programmingLanguage" .) }}
31+
{{ $softwareLD = merge $softwareLD (dict "programmingLanguage" .) }}
2232
{{ end }}
2333

2434
{{ with $page_context.Params.logo }}
25-
{{ with $page_context.Resources.GetMatch . }}
26-
{{ $softwareLD = merge $softwareLD (dict "@type" "ImageObject" "url" .Permalink) }}
27-
{{ end }}
35+
{{ with $page_context.Resources.GetMatch . }}
36+
{{ $softwareLD = merge $softwareLD (dict "logo" (dict "@type" "ImageObject" "url" .Permalink)) }}
37+
{{ end }}
2838
{{ end }}
2939

3040
{{ with $page_context.Params.maintainer }}
31-
{{ $maintainerList := . }}
32-
{{ if not (reflect.IsSlice .) }}{{ $maintainerList = slice . }}{{ end }}
33-
34-
{{ $authorsLD := slice }}
35-
{{ range $maintainerList }}
36-
{{ $authorName := . }}
37-
{{ $nameForProcessing := $authorName | replaceRE "[.]" "" | replaceRE "ć" "c" | replaceRE "Ć" "C" }}
38-
{{ $contributorSlug := $nameForProcessing | anchorize }}
39-
{{ $contributorPage := site.GetPage (printf "contributors/%s" $contributorSlug) }}
41+
{{ $maintainerList := . }}
42+
{{ if not (reflect.IsSlice .) }}{{ $maintainerList = slice . }}{{ end }}
43+
44+
{{ $authorsLD := slice }}
45+
{{ range $maintainerList }}
46+
{{ $authorName := . }}
47+
{{ $nameForProcessing := $authorName | replaceRE "[.]" "" | replaceRE "ć" "c" | replaceRE "Ć" "C" }}
48+
{{ $contributorSlug := $nameForProcessing | anchorize }}
49+
{{ $contributorPage := site.GetPage (printf "contributors/%s" $contributorSlug) }}
50+
51+
{{ $personDict := dict "@type" "Person" "name" $authorName }}
52+
{{ if $contributorPage }}
53+
{{ $personDict = merge $personDict (dict "url" ($contributorPage.Permalink | absLangURL)) }}
54+
{{ end }}
55+
{{ $authorsLD = $authorsLD | append $personDict }}
56+
{{ end }}
4057

41-
{{ $personDict := dict "@type" "Person" "name" $authorName }}
42-
{{ if $contributorPage }}
43-
{{ $personDict = merge $personDict (dict "url" ($contributorPage.Permalink | absLangURL)) }}
44-
{{ end }}
45-
{{ $authorsLD = $authorsLD | append $personDict }}
46-
{{ end }}
47-
48-
{{ $authorKey := cond (eq (len $authorsLD) 1) "author" "author" }}
49-
{{ $authorValue := cond (eq (len $authorsLD) 1) (index $authorsLD 0) $authorsLD }}
50-
{{ $softwareLD = merge $softwareLD (dict $authorKey $authorValue) }}
58+
{{ $authorKey := cond (eq (len $authorsLD) 1) "author" "author" }}
59+
{{ $authorValue := cond (eq (len $authorsLD) 1) (index $authorsLD 0) $authorsLD }}
60+
{{ $softwareLD = merge $softwareLD (dict $authorKey $authorValue) }}
5161
{{ end }}
5262

53-
{{ return $softwareLD }}
63+
{{ return $softwareLD }}

0 commit comments

Comments
 (0)