Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Structured Data Fixes and Feature Image Support #264

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions layouts/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
{{- $title := printf "Overview of all pages with the %s #%s" .Data.Singular $.Title }}
{{- $.Scratch.Set "Title" $title }}
{{- else }}
{{- $.Scratch.Set "Description" ( .Description | default .Params.subtitle | default .Summary ) }}
{{- $.Scratch.Set "Description" ( .Description | default .Params.subtitle | default .Summary | default .Site.Params.Description ) }}
{{- $.Scratch.Set "Title" ( .Title | default .Site.Title ) }}
{{- end }}

Expand All @@ -45,7 +45,7 @@
<link href='{{ . | absURL }}' rel='icon' type='image/x-icon'/>
{{- end -}}
<!-- Social Media Tags -->
{{- with .Params.share_img | default .Params.image | default .Site.Params.logo }}
{{- with .Params.featured_image | default .Params.share_img | default .Params.image| default .Site.Params.logo }}
<meta property="og:image" content="{{ . | absURL }}" />
<meta name="twitter:image" content="{{ . | absURL }}" />
{{- end }}
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/seo/opengraph.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
{{- with .Description | default .Params.subtitle | default .Summary }}
<meta property="og:description" content="{{ . }}">
{{- end }}
{{- with .Params.share_img | default .Params.image | default .Site.Params.logo }}
{{- with .Params.featured_image | default .Params.share_img | default .Params.image| default .Site.Params.logo }}
<meta property="og:image" content="{{ . | absURL }}" />
{{- end }}
{{- with .Site.Params.fb_app_id }}
<meta property="fb:app_id" content="{{ . }}" />
{{- end }}
<meta property="og:url" content="{{ .URL | absLangURL }}" />
<meta property="og:type" content="website" />
<meta property="og:site_name" content="{{ .Site.Title }}" />
<meta property="og:site_name" content="{{ .Site.Title }}" />
9 changes: 5 additions & 4 deletions layouts/partials/seo/structured/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@
"@context": "http://schema.org",
"@type": "Article",
"author": {
"@type": "Person",
"name" : "{{ if .Params.author -}}{{ .Params.author }}{{- else if .Site.Author.name -}}{{ .Site.Author.name }}{{- end }}"
},
"headline": "{{ .Title }}",
"description" : "{{ if .Description }}{{ .Description | plainify }}{{ else }}{{if .IsPage}}{{ .Summary | plainify }}{{ end }}{{ end }}",
"inLanguage" : "{{ .Lang }}",
"wordCount": {{ .WordCount }},
"datePublished" : "{{ .PublishDate.Format "2006-01-02T15:04:05" }}",
"dateModified" : "{{ .Date.Format "2006-01-02T15:04:05" }}",
"image" : "{{ .Site.Params.logo | absURL }}",
"dateModified" : "{{ .Lastmod.Format "2006-01-02T15:04:05" }}",
"image" : " {{ if .Params.featured_image }}{{.Params.featured_image | absURL}}{{else}}{{ .Site.Params.logo | absURL }}{{end}}",
"keywords" : [ "{{ range $i, $e := .Params.tags }}{{ if $i }}, {{ end }}{{ $e }}{{ end }}" ],
"mainEntityOfPage" : "{{ .Permalink }}",
"publisher" : {
"@type": "Organization",
"name" : "{{ .Site.BaseURL }}",
"name" : "{{ .Site.Title }}",
"logo" : {
"@type" : "ImageObject",
"url" : "{{ .Site.Params.logo | absURL }}",
Expand All @@ -25,4 +26,4 @@
}
}
}
</script>
</script>
4 changes: 2 additions & 2 deletions layouts/partials/seo/twitter.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
{{- with .Description | default .Params.subtitle | default .Summary }}
<meta name="twitter:description" content="{{ . | truncate 200 }}">
{{- end }}
{{- with .Params.share_img | default .Params.image | default .Site.Params.logo }}
{{- with .Params.featured_image | default .Params.share_img | default .Params.image| default .Site.Params.logo }}
<meta name="twitter:image" content="{{ . | absURL }}" />
{{- end }}
<meta name="twitter:card" content="summary" />
{{- with .Site.Author.twitter }}
<meta name="twitter:site" content="@{{ . }}" />
<meta name="twitter:creator" content="@{{ . }}" />
{{- end }}
{{- end }}
16 changes: 8 additions & 8 deletions layouts/partials/share-links.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,52 @@
<ul class="share">
<!-- Twitter -->
<li>
<a href="//twitter.com/share?url={{ .Permalink }}&amp;text={{ .Title }}&amp;via={{ .Site.Author.twitter }}" target="_blank" title="Share on Twitter">
<a href="//twitter.com/share?url={{ .Permalink }}&amp;text={{ .Title }}&amp;via={{ .Site.Author.twitter }}" target="_blank" rel="noopener" title="Share on Twitter">
<i class="fab fa-twitter"></i>
</a>
</li>

<!-- Google Plus -->
<li>
<a href="//plus.google.com/share?url={{ .Permalink }}" target="_blank" title="Share on Google Plus">
<a href="//plus.google.com/share?url={{ .Permalink }}" target="_blank" rel="noopener" title="Share on Google Plus">
<i class="fab fa-google-plus"></i>
</a>
</li>

<!-- Facebook -->
<li>
<a href="//www.facebook.com/sharer/sharer.php?u={{ .Permalink }}" target="_blank" title="Share on Facebook">
<a href="//www.facebook.com/sharer/sharer.php?u={{ .Permalink }}" target="_blank" rel="noopener" title="Share on Facebook">
<i class="fab fa-facebook"></i>
</a>
</li>

<!-- Reddit -->
<li>
<a href="//reddit.com/submit?url={{ .Permalink }}&amp;title={{ .Title }}" target="_blank" title="Share on Reddit">
<a href="//reddit.com/submit?url={{ .Permalink }}&amp;title={{ .Title }}" target="_blank" rel="noopener" title="Share on Reddit">
<i class="fab fa-reddit"></i>
</a>
</li>

<!-- LinkedIn -->
<li>
<a href="//www.linkedin.com/shareArticle?url={{ .Permalink }}&amp;title={{ .Title }}" target="_blank" title="Share on LinkedIn">
<a href="//www.linkedin.com/shareArticle?url={{ .Permalink }}&amp;title={{ .Title }}" target="_blank" rel="noopener" title="Share on LinkedIn">
<i class="fab fa-linkedin"></i>
</a>
</li>

<!-- StumbleUpon -->
<li>
<a href="//www.stumbleupon.com/submit?url={{ .Permalink }}&amp;title={{ .Title }}" target="_blank" title="Share on StumbleUpon">
<a href="//www.stumbleupon.com/submit?url={{ .Permalink }}&amp;title={{ .Title }}" target="_blank" rel="noopener" title="Share on StumbleUpon">
<i class="fab fa-stumbleupon"></i>
</a>
</li>

<!-- Pinterest -->
<li>
<a href="//www.pinterest.com/pin/create/button/?url={{ .Permalink }}&amp;description={{ .Title }}" target="_blank" title="Share on Pinterest">
<a href="//www.pinterest.com/pin/create/button/?url={{ .Permalink }}&amp;description={{ .Title }}" target="_blank" rel="noopener" title="Share on Pinterest">
<i class="fab fa-pinterest"></i>
</a>
</li>
</ul>
</div>
{{ end }}
{{ end }}