Skip to content

Commit 317560d

Browse files
committed
add schema required "offers" and "hasCourseInstance" fields
1 parent 552c0aa commit 317560d

File tree

1 file changed

+16
-0
lines changed
  • themes/arm-design-system-hugo-theme/layouts/partials/head

1 file changed

+16
-0
lines changed

themes/arm-design-system-hugo-theme/layouts/partials/head/jsonld.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,22 @@
5151
{{- with .Params.author }}{{ $j = merge $j (dict "author" (dict "@type" "Person" "name" .)) }}{{ end -}}
5252
{{- if $keywords }}{{ $j = merge $j (dict "keywords" (delimit (uniq $keywords) ", ")) }}{{ end -}}
5353
{{- with .Site.Title }}{{ $j = merge $j (dict "provider" (dict "@type" "Organization" "name" .)) }}{{ end -}}
54+
55+
{{- $j = merge $j (dict "offers" (slice (dict "@type" "Offer" "category" "Free"))) -}}
56+
{{- $ci := dict "@type" "CourseInstance" "courseMode" "Online" -}}
57+
{{- if $duration }}{{ $ci = merge $ci (dict "courseWorkload" $duration) }}{{ end -}}
58+
{{- with .Params.course_instances -}}
59+
{{- $instances := slice -}}
60+
{{- range . -}}
61+
{{- $i := dict "@type" "CourseInstance" -}}
62+
{{- with .courseMode }}{{ $i = merge $i (dict "courseMode" .) }}{{ end -}}
63+
{{- with .courseWorkload }}{{ $i = merge $i (dict "courseWorkload" .) }}{{ end -}}
64+
{{- $instances = $instances | append $i -}}
65+
{{- end -}}
66+
{{- if gt (len $instances) 0 }}{{ $j = merge $j (dict "hasCourseInstance" $instances) }}{{ else }}{{ $j = merge $j (dict "hasCourseInstance" (slice $ci)) }}{{ end -}}
67+
{{- else -}}
68+
{{- $j = merge $j (dict "hasCourseInstance" (slice $ci)) -}}
69+
{{- end -}}
5470
{{/* -------- Emit into <head> */}}
5571
<script type="application/ld+json">
5672
{{- /* prettify the JSON (2‑space indent) and mark it as safe JS */ -}}

0 commit comments

Comments
 (0)