Skip to content

Commit

Permalink
feat(talk): add support for event address
Browse files Browse the repository at this point in the history
Forms part of the transition from Microdata to JSON-LD.

See academicpages#413
  • Loading branch information
gcushen committed Sep 9, 2019
1 parent d8fa0b9 commit ec4f5a1
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 4 deletions.
6 changes: 6 additions & 0 deletions archetypes/talk/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ title: "{{ replace .Name "-" " " | title }}"
event:
event_url:
location:
address:
street:
city:
region:
postcode:
country:
summary:
abstract:

Expand Down
10 changes: 9 additions & 1 deletion exampleSite/content/talk/example/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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."

Expand Down
11 changes: 10 additions & 1 deletion layouts/partials/jsonld/event.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
15 changes: 13 additions & 2 deletions layouts/talk/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,24 @@ <h3>{{ i18n "abstract" }}</h3>
</div>
<div class="d-md-none space-below"></div>

{{ with .Params.location }}
{{ if .Params.location }}
<div class="row">
<div class="col-md-1"></div>
<div class="col-md-10">
<div class="row">
<div class="col-12 col-md-3 pub-row-heading">{{ i18n "location" }}</div>
<div class="col-12 col-md-9">{{ . | markdownify }}</div>
<div class="col-12 col-md-9">{{ .Params.location | markdownify }}</div>
{{ 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 ", ") }}
<div class="col-md-3"></div>
<div class="col-12 col-md-9">{{$addr_formatted}}</div>
{{end}}
</div>
</div>
<div class="col-md-1"></div>
Expand Down

0 comments on commit ec4f5a1

Please sign in to comment.