123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- {{ $page := .page }}
- {{ $summary := .summary }}
- {{ $featured_image := ($page.Resources.ByType "image").GetMatch "*featured*" }}
- {{/* Get author name. */}}
- {{ $author_username := "" }}
- {{ if and (not $page.Params.authors) ($page.Scratch.Get "superuser_username") }}
- {{ $author_username = $page.Scratch.Get "superuser_username" }}
- {{ else if $page.Params.authors }}
- {{ $author_username = index $page.Params.authors 0 }}
- {{ end }}
- {{ $author := "" }}
- {{ $taxonomy := "authors" }}
- {{ $profile_page := site.GetPage (printf "/%s/%s" $taxonomy $author_username) }}
- {{ with $profile_page }}
- {{ $author = .Params.name | default .Title }}
- {{ end }}
- <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}}
- "startDate": {{ $page.Date.Format "2006-01-02T15:04:05Z07:00" }},
- {{with $page.Params.date_end}}
- "endDate": {{ (time .).Format "2006-01-02T15:04:05Z07:00" }},
- {{end}}
- {{with $author}}
- "performer": {
- "@type": "Person",
- "name": {{.}}
- },
- {{end}}
- "description": {{$summary}}
- }
- </script>
|