Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
<link rel="canonical" href="https://learn.arm.com{{ .Permalink }}" />
<title>{{ $title }}</title>

{{ partial "head/jsonld.html" . }}

<!-- Include the Arm standard Lato font for machines that don't have by default (Mac) -->
<!-- Can be done automatically now in cross-page.css locally to speed up process -->
<link rel="preconnect" href="https://fonts.gstatic.com" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{{/* layouts/partials/head/jsonld.html */}}
{{/* ---------------------------------------------------------------
Render JSON‑LD only for Learning‑Path _index.md main pages
---------------------------------------------------------------- */}}
{{- if and .IsSection (eq .Params.learning_path_main_page "yes") -}}
{{/* -------- Helper : Build ISO‑8601 duration (PT30M, PT2H, …) */}}
{{- $duration := "" -}}
{{- with .Params.minutes_to_complete -}}
{{- $duration = printf "PT%dM" (int .) -}}
{{- end -}}
{{/* -------- Learning objectives & prerequisites */}}
{{- $objectives := slice -}}
{{- with .Params.learning_objectives -}}
{{- range . }}{{ $objectives = $objectives | append ( . | plainify ) }}{{ end -}}
{{- end -}}
{{- $prereqs := slice -}}
{{- with .Params.prerequisites -}}
{{- range . }}{{ $prereqs = $prereqs | append ( . | plainify ) }}{{ end -}}
{{- end -}}
{{/* -------- Collect tag‑style params into one keywords list */}}
{{- $keywords := slice -}}
{{- $tagParams := slice
"skilllevels"
"cloud_service_providers"
"armips"
"subjects"
"operatingsystems"
"tools_software_languages"
-}}
{{- range $tagParams -}}
{{- $v := index $.Params . -}}
{{- with $v -}}
{{- if reflect.IsSlice $v -}}
{{- range $v }}{{ $keywords = $keywords | append ( . | plainify ) }}{{ end -}}
{{- else -}}
{{- $keywords = $keywords | append ( $v | plainify ) -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/* -------- Assemble JSON‑LD dict */}}
{{- $j := dict
"@context" "https://schema.org"
"@type" "Course"
"name" .Title
-}}
{{- with .Params.who_is_this_for }}{{ $j = merge $j (dict "description" ( . | plainify )) }}{{ end -}}
{{- if $duration }}{{ $j = merge $j (dict "timeRequired" $duration) }}{{ end -}}
{{- with .Params.skilllevels }}{{ $j = merge $j (dict "educationalLevel" .) }}{{ end -}}
{{- with $objectives }}{{ if gt (len .) 0 }}{{ $j = merge $j (dict "teaches" .) }}{{ end }}{{ end -}}
{{- with $prereqs }}{{ if gt (len .) 0 }}{{ $j = merge $j (dict "competencyRequired" .) }}{{ end }}{{ end -}}
{{- with .Params.author }}{{ $j = merge $j (dict "author" (dict "@type" "Person" "name" .)) }}{{ end -}}
{{- if $keywords }}{{ $j = merge $j (dict "keywords" (delimit (uniq $keywords) ", ")) }}{{ end -}}
{{- with .Site.Title }}{{ $j = merge $j (dict "provider" (dict "@type" "Organization" "name" .)) }}{{ end -}}
{{/* -------- Emit into <head> */}}
<script type="application/ld+json">
{{- /* prettify the JSON (2‑space indent) and mark it as safe JS */ -}}
{{- $j | jsonify (dict "indent" " ") | safeJS -}}
</script>
{{- end -}}