mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-12 20:15:25 +00:00
site_head.html, jsonld/article.html, jsonld/qapage.html, and jsonld/event.html hardcode `(.Resources.ByType "image").GetMatch "*featured*"` to find featured images. This ignores custom filenames set via `.Params.image.filename` in front matter, causing og:image and JSON-LD image to fall back to the site icon. Replace the hardcoded pattern with the `get_featured_image` partial (already used by jsonld/webpage.html), which properly searches for: 1. Files matching `*featured*` in the page directory 2. Custom filename from `.Params.image.filename` in the page directory 3. Custom filename in `assets/media/` directory Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
49 lines
1.4 KiB
HTML
49 lines
1.4 KiB
HTML
{{ $page := .page }}
|
|
{{ $summary := .summary }}
|
|
{{ $featured_image := partial "functions/get_featured_image" $page }}
|
|
{{ $author := partial "functions/get_author_name" $page }}
|
|
|
|
<script type="application/ld+json">
|
|
{
|
|
"@context": "https://schema.org",
|
|
"@type": "Event",
|
|
"mainEntityOfPage": {
|
|
"@type": "WebPage",
|
|
"@id": {{$page.Permalink}}
|
|
},
|
|
"name": {{$page.Title}},
|
|
{{ with $page.Params.location }}
|
|
"location": {
|
|
"@type": "Place",
|
|
"name": {{. | plainify}}{{if $page.Params.address}},
|
|
"address": {
|
|
"@type": "PostalAddress",
|
|
"streetAddress": {{$page.Params.address.street | default ""}},
|
|
"addressLocality": {{$page.Params.address.city | default ""}},
|
|
"postalCode": {{$page.Params.address.postcode | default ""}},
|
|
"addressRegion": {{$page.Params.address.region | default ""}},
|
|
"addressCountry": {{$page.Params.address.country | default ""}}
|
|
}
|
|
{{end}}
|
|
},
|
|
{{end}}
|
|
{{ if $featured_image }}
|
|
"image": [
|
|
{{$featured_image.Permalink}}
|
|
],
|
|
{{end}}
|
|
{{ $start := $page.Params.event_start | default $page.Date }}
|
|
"startDate": {{ (time $start).Format "2006-01-02T15:04:05Z07:00" }},
|
|
{{with ($page.Params.event_end | default $page.Params.date_end)}}
|
|
"endDate": {{ (time .).Format "2006-01-02T15:04:05Z07:00" }},
|
|
{{end}}
|
|
{{with $author}}
|
|
"performer": {
|
|
"@type": "Person",
|
|
"name": {{.}}
|
|
},
|
|
{{end}}
|
|
"description": {{$summary}}
|
|
}
|
|
</script>
|