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

Commit

Permalink
Correct some issues with open graph and schema (#242)
Browse files Browse the repository at this point in the history
Fixes #234
Fixes #236

Signed-off-by: Matt Stratton <[email protected]>
  • Loading branch information
mattstratton authored Feb 17, 2017
1 parent 1c77f87 commit f025d7b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
1 change: 1 addition & 0 deletions exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,4 @@ title = "los dias de devops"
# Set to "/" on *nix and Mac, "\\" on Windows
# Refer to https://github.com/spf13/hugo/issues/2394 for more information
pathseperator = "/"
weburl = "https://dev.devopsdays.org"
19 changes: 17 additions & 2 deletions layouts/partials/events/event_metadata.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,33 @@
{{ $e := (index $.Site.Data.events $event_slug) }}
{{/* end site data query */}}

{{ $.Scratch.Add "url" $.Site.Params.weburl }}
{{ $.Scratch.Add "url" "/events/"}}
{{ $.Scratch.Add "url" $event_slug }}



{{- if $e.startdate -}}


{{ $url := $.Scratch.Get "url" }}
{{ $.Scratch.Add "image_url" $url }}
{{ $.Scratch.Add "image_url" "/logo.png" }}
{{ $image_url := $.Scratch.Get "image_url" }}
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "ExhibitionEvent",
{{ if $e.description }}
"description": {{ $e.description }}
{{ else }}
"description": "The conference that brings development and operations together.",
{{ end }}
"name": "DevOpsDays {{ $e.city }} {{ $e.year }}",
"startDate": "{{ $e.startdate }}",
"endDate": "{{ $e.enddate }}",
"url": {{ .Permalink }},
"image": {{ string ( delimit ( slice "/events/" $event_slug "/logo.png") "" ) | absURL }},
"url": {{ $url }},
"image": {{ $image_url }},
"location": {
"@type": "Place",
{{ if eq $e.city $e.location }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/head/seo/open_graph.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<meta property="og:title" content="{{ title .Title }}" />
<meta property="og:description" content="{{ if .Description }}{{ .Description }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ end }}{{ end }}" />
<meta property="og:type" content="{{ if .Params.type }}{{ .Params.type }}{{ else }}website{{ end }}" />
<meta property="og:url" content="{{ $.Site.Params.weburl }}{{ .Permalink }}" />
<meta property="og:url" content="{{ $.Site.Params.weburl }}{{ .Permalink | relURL }}" />
{{ if .IsHome }}
<meta property="og:image" content="{{ $.Site.Params.weburl }}/img/event-logo-default.png" />
{{ else }}
Expand Down

0 comments on commit f025d7b

Please sign in to comment.