|
| 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