event.html 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. {{ $page := .page }}
  2. {{ $summary := .summary }}
  3. {{ $featured_image := ($page.Resources.ByType "image").GetMatch "*featured*" }}
  4. {{ $author := partial "functions/get_author_name" $page }}
  5. <script type="application/ld+json">
  6. {
  7. "@context": "https://schema.org",
  8. "@type": "Event",
  9. "mainEntityOfPage": {
  10. "@type": "WebPage",
  11. "@id": {{$page.Permalink}}
  12. },
  13. "name": {{$page.Title}},
  14. {{ with $page.Params.location }}
  15. "location": {
  16. "@type": "Place",
  17. "name": {{. | plainify}}{{if $page.Params.address}},
  18. "address": {
  19. "@type": "PostalAddress",
  20. "streetAddress": {{$page.Params.address.street | default ""}},
  21. "addressLocality": {{$page.Params.address.city | default ""}},
  22. "postalCode": {{$page.Params.address.postcode | default ""}},
  23. "addressRegion": {{$page.Params.address.region | default ""}},
  24. "addressCountry": {{$page.Params.address.country | default ""}}
  25. }
  26. {{end}}
  27. },
  28. {{end}}
  29. {{ if $featured_image }}
  30. "image": [
  31. {{$featured_image.Permalink}}
  32. ],
  33. {{end}}
  34. "startDate": {{ $page.Date.Format "2006-01-02T15:04:05Z07:00" }},
  35. {{with $page.Params.date_end}}
  36. "endDate": {{ (time .).Format "2006-01-02T15:04:05Z07:00" }},
  37. {{end}}
  38. {{with $author}}
  39. "performer": {
  40. "@type": "Person",
  41. "name": {{.}}
  42. },
  43. {{end}}
  44. "description": {{$summary}}
  45. }
  46. </script>