From ec4f5a11bf9f0420c922b8818ded8b8004951a6f Mon Sep 17 00:00:00 2001 From: George Cushen Date: Mon, 9 Sep 2019 17:33:08 +0100 Subject: [PATCH] feat(talk): add support for event address Forms part of the transition from Microdata to JSON-LD. See #413 --- archetypes/talk/index.md | 6 ++++++ exampleSite/content/talk/example/index.md | 10 +++++++++- layouts/partials/jsonld/event.html | 11 ++++++++++- layouts/talk/single.html | 15 +++++++++++++-- 4 files changed, 38 insertions(+), 4 deletions(-) diff --git a/archetypes/talk/index.md b/archetypes/talk/index.md index 4e0d592d..f7e8f4e5 100644 --- a/archetypes/talk/index.md +++ b/archetypes/talk/index.md @@ -5,6 +5,12 @@ title: "{{ replace .Name "-" " " | title }}" event: event_url: location: +address: + street: + city: + region: + postcode: + country: summary: abstract: diff --git a/exampleSite/content/talk/example/index.md b/exampleSite/content/talk/example/index.md index bbabff54..c07b5a45 100644 --- a/exampleSite/content/talk/example/index.md +++ b/exampleSite/content/talk/example/index.md @@ -2,7 +2,15 @@ title: Example Talk event: Academic Theme Conference event_url: https://example.org -location: London, United Kingdom + +location: Source Themes HQ +address: + street: 450 Serra Mall + city: Stanford + region: CA + postcode: '94305' + country: United States + summary: An example talk using Academic's Markdown slides feature. abstract: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis posuere tellusac convallis placerat. Proin tincidunt magna sed ex sollicitudin condimentum. Sed ac faucibus dolor, scelerisque sollicitudin nisi. Cras purus urna, suscipit quis sapien eu, pulvinar tempor diam." diff --git a/layouts/partials/jsonld/event.html b/layouts/partials/jsonld/event.html index 8771e7dc..92c71bce 100644 --- a/layouts/partials/jsonld/event.html +++ b/layouts/partials/jsonld/event.html @@ -28,7 +28,16 @@ {{ with $page.Params.location }} "location": { "@type": "Place", - "name": {{. | plainify}} + "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 }} diff --git a/layouts/talk/single.html b/layouts/talk/single.html index 8a3991c2..c62fd023 100644 --- a/layouts/talk/single.html +++ b/layouts/talk/single.html @@ -43,13 +43,24 @@
- {{ with .Params.location }} + {{ if .Params.location }}
{{ i18n "location" }}
-
{{ . | markdownify }}
+
{{ .Params.location | markdownify }}
+ {{ if .Params.address }} + {{ $addr := slice }} + {{with .Params.address.street}}{{$addr = $addr | append .}}{{end}} + {{with .Params.address.city}}{{$addr = $addr | append .}}{{end}} + {{with .Params.address.region}}{{$addr = $addr | append .}}{{end}} + {{with .Params.address.postcode}}{{$addr = $addr | append .}}{{end}} + {{with .Params.address.country}}{{$addr = $addr | append .}}{{end}} + {{ $addr_formatted := delimit $addr (site.Params.address_delimiter | default ", ") }} +
+
{{$addr_formatted}}
+ {{end}}