Skip to content

Commit b0b4171

Browse files
authored
Merge pull request #297 from neural-loop/main
Structured Markup for Software Items
2 parents 116eb20 + 2f7b98e commit b0b4171

File tree

3 files changed

+68
-1
lines changed

3 files changed

+68
-1
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Deploy Hugo site to Pages
22

33
on:
44
push:
5-
branches: ["main", "volunteer-opportunities"]
5+
branches: ["main"]
66

77
permissions:
88
contents: read

layouts/partials/structured-markup/jsonld.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
{{ with partial "structured-markup/contributor.html" . }}
1919
{{ $jsonLDs = $jsonLDs | append . }}
2020
{{ end }}
21+
{{ else if eq .Type "neuromorphic-software" }}
22+
{{ with partial "structured-markup/software.html" . }}
23+
{{ $jsonLDs = $jsonLDs | append . }}
24+
{{ end }}
2125
{{ end }}
2226
{{ end }}
2327

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{{ $page_context := . }}
2+
{{ $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"
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+
)
19+
}}
20+
21+
{{ with $page_context.Params.license }}
22+
{{ $softwareLD = merge $softwareLD (dict "license" (printf "https://spdx.org/licenses/%s.html" .)) }}
23+
{{ end }}
24+
{{ with $page_context.Params.source_code }}
25+
{{ $softwareLD = merge $softwareLD (dict "codeRepository" .) }}
26+
{{ end }}
27+
{{ with $page_context.Params.website }}
28+
{{ $softwareLD = merge $softwareLD (dict "softwareHelp" .) }}
29+
{{ end }}
30+
{{ with $page_context.Params.language }}
31+
{{ $softwareLD = merge $softwareLD (dict "programmingLanguage" .) }}
32+
{{ end }}
33+
34+
{{ with $page_context.Params.logo }}
35+
{{ with $page_context.Resources.GetMatch . }}
36+
{{ $softwareLD = merge $softwareLD (dict "logo" (dict "@type" "ImageObject" "url" .Permalink)) }}
37+
{{ end }}
38+
{{ end }}
39+
40+
{{ with $page_context.Params.maintainer }}
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 }}
57+
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) }}
61+
{{ end }}
62+
63+
{{ return $softwareLD }}

0 commit comments

Comments
 (0)