Skip to content
This repository has been archived by the owner on Jul 21, 2019. It is now read-only.

Commit

Permalink
Make schema metadata only show on events with a startdate
Browse files Browse the repository at this point in the history
Fixes #212

Signed-off-by: Matt Stratton <[email protected]>
  • Loading branch information
mattstratton committed Feb 17, 2017
1 parent 259e01a commit 786f99e
Showing 1 changed file with 23 additions and 21 deletions.
44 changes: 23 additions & 21 deletions layouts/partials/events/event_metadata.html
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
{{/* site data query copypasta from event/single.html, per mattstratton's note - esigler */}}
{{ $path := split $.Source.File.Path .Site.Params.pathseperator }}
{{ $event_slug := index $path 1 }}
{{ $e := (index $.Site.Data.events $event_slug) }}
{{/* end site data query */}}

<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "ExhibitionEvent",
"description": "The conference that brings development and operations together.",
"name": "DevOpsDays {{ $e.city }} {{ $e.year }}",
"startDate": "{{ $e.startdate }}",
"endDate": "{{ $e.enddate }}",
"url": {{ .Permalink }},
"image": {{ string ( delimit ( slice "/events/" $event_slug "/logo.png") "" ) | absURL }},
"location": {
"@type": "Place",
{{ if eq $e.city $e.location }}
"name": "{{ $e.city }}",
{{ else }}
"name": "{{ $e.location }}, {{ $e.city }}",
{{ end }}
"address": "{{ $e.coordinates }}"
{{- if $e.startdate -}}

<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "ExhibitionEvent",
"description": "The conference that brings development and operations together.",
"name": "DevOpsDays {{ $e.city }} {{ $e.year }}",
"startDate": "{{ $e.startdate }}",
"endDate": "{{ $e.enddate }}",
"url": {{ .Permalink }},
"image": {{ string ( delimit ( slice "/events/" $event_slug "/logo.png") "" ) | absURL }},
"location": {
"@type": "Place",
{{ if eq $e.city $e.location }}
"name": "{{ $e.city }}",
{{ else }}
"name": "{{ $e.location }}, {{ $e.city }}",
{{ end }}
"address": "{{ $e.coordinates }}"
}
}
}
</script>
</script>
{{- end -}}

0 comments on commit 786f99e

Please sign in to comment.