|
20 | 20 | {% endunless %} |
21 | 21 |
|
22 | 22 | {%- comment -%} |
23 | | -Stable @id URIs cross-referenced from every page's @graph. |
| 23 | +Stable @id URIs cross-referenced from every page's @graph. The page_id suffix |
| 24 | +matches the page's primary @type so the graph reads naturally: |
| 25 | +post → #article, /about/ → #profilepage, /tags/ + tagpages → #collection, |
| 26 | +everything else → #webpage. |
24 | 27 | {%- endcomment -%} |
25 | 28 | {%- assign person_id = site.url | append: '/about/#stanislaw' -%} |
26 | 29 | {%- assign website_id = site.url | append: '/#website' -%} |
27 | | -{%- assign page_id = page.url | absolute_url | append: '#webpage' -%} |
| 30 | +{%- assign breadcrumb_id = page.url | absolute_url | append: '#breadcrumb' -%} |
| 31 | +{%- if page.layout == "post" -%} |
| 32 | + {%- assign page_id = page.url | absolute_url | append: '#article' -%} |
| 33 | +{%- elsif page.url == "/about/" -%} |
| 34 | + {%- assign page_id = page.url | absolute_url | append: '#profilepage' -%} |
| 35 | +{%- elsif page.url == "/tags/" or page.layout == "tagpage" -%} |
| 36 | + {%- assign page_id = page.url | absolute_url | append: '#collection' -%} |
| 37 | +{%- else -%} |
| 38 | + {%- assign page_id = page.url | absolute_url | append: '#webpage' -%} |
| 39 | +{%- endif -%} |
28 | 40 |
|
29 | 41 | <script type="application/ld+json"> |
30 | 42 | { |
|
43 | 55 | "@type": "Person", |
44 | 56 | "@id": "{{ person_id }}", |
45 | 57 | "name": "Stanisław Szołkowski", |
| 58 | + "alternateName": "Stanislaw Szolkowski", |
46 | 59 | "givenName": "Stanisław", |
47 | 60 | "familyName": "Szołkowski", |
48 | 61 | "knowsLanguage": ["en", "pl"], |
49 | 62 | "url": "{{ '/about/' | absolute_url }}", |
50 | | - "image": "{{ person_image | absolute_url }}", |
| 63 | + "image": { |
| 64 | + "@type": "ImageObject", |
| 65 | + "@id": "{{ site.url }}/about/#stanislaw-photo", |
| 66 | + "url": "{{ person_image | absolute_url }}", |
| 67 | + "width": 400, |
| 68 | + "height": 400, |
| 69 | + "caption": "Stanisław Szołkowski" |
| 70 | + }, |
51 | 71 | "jobTitle": "Principal .NET/Optimizely Engineer", |
52 | 72 | "award": [ |
53 | 73 | "Optimizely MVP 2025", |
|
102 | 122 | "@type": "ImageObject", |
103 | 123 | "url": "{{ person_image | absolute_url }}" |
104 | 124 | }, |
105 | | - "breadcrumb": { "@id": "{{ page.url | absolute_url }}#breadcrumb" } |
| 125 | + "breadcrumb": { "@id": "{{ breadcrumb_id }}" } |
106 | 126 | }, |
107 | 127 | { |
108 | 128 | "@type": "BreadcrumbList", |
109 | | - "@id": "{{ page.url | absolute_url }}#breadcrumb", |
| 129 | + "@id": "{{ breadcrumb_id }}", |
110 | 130 | "itemListElement": [ |
111 | 131 | {"@type": "ListItem", "position": 1, "name": "Home", "item": "{{ '/' | absolute_url }}"}, |
112 | 132 | {"@type": "ListItem", "position": 2, "name": "About"} |
113 | 133 | ] |
114 | 134 | } |
115 | 135 | {%- elsif page.layout == "post" -%} |
| 136 | + {%- assign primary = page.primary_tag | default: page.tags.first -%} |
| 137 | + {%- assign primary_slug = primary | slugify -%} |
116 | 138 | , |
117 | 139 | { |
118 | 140 | "@type": "BlogPosting", |
|
126 | 148 | "author": { "@id": "{{ person_id }}" }, |
127 | 149 | "publisher": { "@id": "{{ person_id }}" }, |
128 | 150 | "isPartOf": { "@id": "{{ website_id }}" }, |
129 | | - "mainEntityOfPage": { "@id": "{{ page_id }}" } |
| 151 | + "mainEntityOfPage": { "@id": "{{ page_id }}" }, |
| 152 | + "breadcrumb": { "@id": "{{ breadcrumb_id }}" }, |
| 153 | + "keywords": {{ page.tags | join: ", " | jsonify }}, |
| 154 | + "articleSection": {{ primary | jsonify }}, |
| 155 | + "wordCount": {{ content | strip_html | number_of_words }} |
130 | 156 | {%- if page.image -%} |
131 | 157 | , |
132 | 158 | "image": { |
133 | 159 | "@type": "ImageObject", |
134 | 160 | "url": "{{ page.image.path | absolute_url }}", |
135 | | - "description": {{ page.image.alt | jsonify }} |
| 161 | + "width": {{ page.image.width | plus: 0 }}, |
| 162 | + "height": {{ page.image.height | plus: 0 }}, |
| 163 | + "caption": {{ page.image.alt | jsonify }} |
136 | 164 | } |
137 | 165 | {%- endif -%} |
138 | 166 | }, |
139 | 167 | { |
140 | 168 | "@type": "BreadcrumbList", |
| 169 | + "@id": "{{ breadcrumb_id }}", |
141 | 170 | "itemListElement": [ |
142 | 171 | {"@type": "ListItem", "position": 1, "name": "Home", "item": "{{ '/' | absolute_url }}"}, |
143 | | - {"@type": "ListItem", "position": 2, "name": "Archive", "item": "{{ '/archive/' | absolute_url }}"}, |
| 172 | + {"@type": "ListItem", "position": 2, "name": {{ primary | jsonify }}, "item": "{{ '/tags/' | append: primary_slug | absolute_url }}"}, |
144 | 173 | {"@type": "ListItem", "position": 3, "name": {{ page.title | jsonify }}, "item": "{{ page.url | absolute_url }}"} |
145 | 174 | ] |
146 | 175 | } |
|
154 | 183 | "description": {{ page.description | jsonify }}, |
155 | 184 | "inLanguage": "en-US", |
156 | 185 | "isPartOf": { "@id": "{{ website_id }}" }, |
| 186 | + "breadcrumb": { "@id": "{{ breadcrumb_id }}" }, |
157 | 187 | "mainEntity": { |
158 | 188 | "@type": "ItemList", |
159 | 189 | "numberOfItems": {{ site.tags | size }}, |
|
169 | 199 | }, |
170 | 200 | { |
171 | 201 | "@type": "BreadcrumbList", |
| 202 | + "@id": "{{ breadcrumb_id }}", |
172 | 203 | "itemListElement": [ |
173 | 204 | {"@type": "ListItem", "position": 1, "name": "Home", "item": "{{ '/' | absolute_url }}"}, |
174 | 205 | {"@type": "ListItem", "position": 2, "name": "Tags", "item": "{{ '/tags/' | absolute_url }}"} |
|
182 | 213 | "url": "{{ page.url | absolute_url }}", |
183 | 214 | "name": {{ page.title | jsonify }}, |
184 | 215 | "inLanguage": "en-US", |
185 | | - "isPartOf": { "@id": "{{ website_id }}" } |
| 216 | + "isPartOf": { "@id": "{{ website_id }}" }, |
| 217 | + "breadcrumb": { "@id": "{{ breadcrumb_id }}" } |
186 | 218 | }, |
187 | 219 | { |
188 | 220 | "@type": "BreadcrumbList", |
| 221 | + "@id": "{{ breadcrumb_id }}", |
189 | 222 | "itemListElement": [ |
190 | 223 | {"@type": "ListItem", "position": 1, "name": "Home", "item": "{{ '/' | absolute_url }}"}, |
191 | 224 | {"@type": "ListItem", "position": 2, "name": "Tags", "item": "{{ '/tags/' | absolute_url }}"}, |
|
201 | 234 | "name": {{ page.title | jsonify }}, |
202 | 235 | "inLanguage": "en-US", |
203 | 236 | "isPartOf": { "@id": "{{ website_id }}" }, |
204 | | - "breadcrumb": { "@id": "{{ page.url | absolute_url }}#breadcrumb" } |
| 237 | + "breadcrumb": { "@id": "{{ breadcrumb_id }}" } |
205 | 238 | }, |
206 | 239 | { |
207 | 240 | "@type": "BreadcrumbList", |
208 | | - "@id": "{{ page.url | absolute_url }}#breadcrumb", |
| 241 | + "@id": "{{ breadcrumb_id }}", |
209 | 242 | "itemListElement": [ |
210 | 243 | {"@type": "ListItem", "position": 1, "name": "Home", "item": "{{ '/' | absolute_url }}"}, |
211 | 244 | {"@type": "ListItem", "position": 2, "name": "Archive"} |
|
0 commit comments