Skip to content

Commit b869b11

Browse files
committed
feat: enhance structured data with worksFor and memberOf fields
- Updated `schema-jsonld.html` to include `worksFor` and `memberOf` properties for richer organization details. - Added corresponding configurations in `hugo.toml` for `id`, `worksFor`, and `memberOf` data.
1 parent 8a42202 commit b869b11

2 files changed

Lines changed: 37 additions & 3 deletions

File tree

hugo.toml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,26 @@ avatar = "/maarten.webp"
1414

1515
[params.person]
1616
name = "Maarten Casteels"
17+
id = "https://casteels.dev/#maarten-casteels"
1718
url = "https://casteels.dev"
1819
image = "/maarten.webp"
20+
worksFor = { name = "Sopra Steria BeLux", url = "https://www.soprasteria.be/" }
1921
sameAs = [
2022
"https://github.com/denmette",
2123
"https://www.linkedin.com/in/maartencasteels",
2224
"https://bsky.app/profile/casteels.dev",
23-
"https://denmette.be/",
24-
"https://x.com/denmette"
25+
"https://x.com/denmette",
26+
"https://denmette.be/"
2527
]
28+
[[params.person.memberOf]]
29+
name = "JCast"
30+
url = "https://jcast.dev/"
31+
roleName = "Co-host"
32+
33+
[[params.person.memberOf]]
34+
name = "Top Vakantie VZW"
35+
url = "https://www.topvakantie.be/"
36+
roleName = "Vrijwilliger"
2637

2738
[params.comments]
2839
repo = "denmette/denmette.github.io"

themes/custom/layouts/partials/schema-jsonld.html

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@
1111
{{- $personURL := $person.url | default .Site.BaseURL -}}
1212
{{- $personImage := $person.image | default .Site.Params.avatar -}}
1313
{{- $sameAs := $person.sameAs | default .Site.Params.sameAs -}}
14+
{{- $worksFor := $person.worksFor -}}
15+
{{- $memberOf := $person.memberOf -}}
1416
{{- $personId := printf "%s#maarten" (.Site.BaseURL | absURL) -}}
17+
{{- if $person.id -}}
18+
{{- $personId = $person.id -}}
19+
{{- end -}}
1520
<script type="application/ld+json">
1621
{
1722
"@context": "https://schema.org",
@@ -20,7 +25,25 @@
2025
"name": {{ $personName | jsonify }},
2126
"url": {{ $personURL | absURL | jsonify }}{{ if $personImage }},
2227
"image": {{ $personImage | absURL | jsonify }}{{ end }}{{ if $sameAs }},
23-
"sameAs": {{ $sameAs | jsonify }}{{ end }}
28+
"sameAs": {{ $sameAs | jsonify }}{{ end }}{{ if $worksFor }},
29+
"worksFor": {
30+
"@type": "Organization",
31+
"name": {{ $worksFor.name | jsonify }}{{ with $worksFor.url }},
32+
"url": {{ . | jsonify }}{{ end }}
33+
}{{ end }}{{ if $memberOf }},
34+
"memberOf": [
35+
{{- range $index, $org := $memberOf }}{{ if $index }},{{ end }}
36+
{
37+
"@type": "Organization",
38+
"name": {{ $org.name | jsonify }}{{ with $org.url }},
39+
"url": {{ . | jsonify }}{{ end }}{{ with $org.roleName }},
40+
"member": {
41+
"@type": "Role",
42+
"roleName": {{ . | jsonify }}
43+
}{{ end }}
44+
}
45+
{{- end }}
46+
]{{ end }}
2447
}
2548
</script>
2649
{{- if eq .Section "posts" -}}

0 commit comments

Comments
 (0)