diff options
author | Christoph Cullmann <cullmann@kde.org> | 2019-08-03 22:26:50 +0200 |
---|---|---|
committer | Christoph Cullmann <cullmann@kde.org> | 2019-08-03 22:26:50 +0200 |
commit | ec1341fcd178d72e1accd308d1ae314702e69c01 (patch) | |
tree | 927c5113475a982af7a4809af78a8f4b4990be62 /themes/beautifulhugo/layouts/partials/seo | |
parent | 05bc58562c52539f196ae4357afd80a23d34e812 (diff) |
use new theme
Diffstat (limited to 'themes/beautifulhugo/layouts/partials/seo')
9 files changed, 155 insertions, 0 deletions
diff --git a/themes/beautifulhugo/layouts/partials/seo/main.html b/themes/beautifulhugo/layouts/partials/seo/main.html new file mode 100644 index 0000000..a0f7ff7 --- /dev/null +++ b/themes/beautifulhugo/layouts/partials/seo/main.html @@ -0,0 +1,3 @@ +{{- partial "seo/schema" . }} +{{- partial "seo/opengraph" . }} +{{- partial "seo/twitter" . }}
\ No newline at end of file diff --git a/themes/beautifulhugo/layouts/partials/seo/opengraph.html b/themes/beautifulhugo/layouts/partials/seo/opengraph.html new file mode 100644 index 0000000..9a14a07 --- /dev/null +++ b/themes/beautifulhugo/layouts/partials/seo/opengraph.html @@ -0,0 +1,15 @@ +{{- with .Title | default .Site.Title }} +<meta property="og:title" content="{{ . }}" /> +{{- end }} +{{- with .Description | default .Params.subtitle | default .Summary }} +<meta property="og:description" content="{{ . }}"> +{{- end }} +{{- with .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="{{ .Permalink | absLangURL }}" /> +<meta property="og:type" content="website" /> +<meta property="og:site_name" content="{{ .Site.Title }}" /> diff --git a/themes/beautifulhugo/layouts/partials/seo/schema.html b/themes/beautifulhugo/layouts/partials/seo/schema.html new file mode 100644 index 0000000..f201796 --- /dev/null +++ b/themes/beautifulhugo/layouts/partials/seo/schema.html @@ -0,0 +1,6 @@ +{{- partial "seo/structured/website" . }} +{{- partial "seo/structured/organization" . }} +{{ if .IsPage }} +{{- partial "seo/structured/breadcrumb" . }} +{{- partial "seo/structured/article" . }} +{{ end }}
\ No newline at end of file diff --git a/themes/beautifulhugo/layouts/partials/seo/structured/article.html b/themes/beautifulhugo/layouts/partials/seo/structured/article.html new file mode 100644 index 0000000..b828456 --- /dev/null +++ b/themes/beautifulhugo/layouts/partials/seo/structured/article.html @@ -0,0 +1,28 @@ +<script type="application/ld+json"> +{ + "@context": "http://schema.org", + "@type": "Article", + "author": { + "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 }}", + "keywords" : [ "{{ range $i, $e := .Params.tags }}{{ if $i }}, {{ end }}{{ $e }}{{ end }}" ], + "mainEntityOfPage" : "{{ .Permalink }}", + "publisher" : { + "@type": "Organization", + "name" : "{{ .Site.BaseURL }}", + "logo" : { + "@type" : "ImageObject", + "url" : "{{ .Site.Params.logo | absURL }}", + "height" : 60 , + "width" : 60 + } + } +} +</script>
\ No newline at end of file diff --git a/themes/beautifulhugo/layouts/partials/seo/structured/breadcrumb.html b/themes/beautifulhugo/layouts/partials/seo/structured/breadcrumb.html new file mode 100644 index 0000000..81ac41b --- /dev/null +++ b/themes/beautifulhugo/layouts/partials/seo/structured/breadcrumb.html @@ -0,0 +1,21 @@ +<script type="application/ld+json"> +{ + "@context": "http://schema.org", + "@type": "BreadcrumbList", + "itemListElement": [{ + "@type": "ListItem", + "position": 1, + "item": { + "@id": "{{ .Site.BaseURL }}", + "name": "home" + } + },{ + "@type": "ListItem", + "position": 3, + "item": { + "@id": "{{ .Permalink }}", + "name": "{{ .Title | humanize }}" + } + }] +} +</script>
\ No newline at end of file diff --git a/themes/beautifulhugo/layouts/partials/seo/structured/organization.html b/themes/beautifulhugo/layouts/partials/seo/structured/organization.html new file mode 100644 index 0000000..117bccd --- /dev/null +++ b/themes/beautifulhugo/layouts/partials/seo/structured/organization.html @@ -0,0 +1,12 @@ +<script type="application/ld+json"> +{ + "@context": "http://schema.org", + "@type": "Organization", + "name": "{{ .Site.Params.organizationName }}", + "url": "{{ .Site.BaseURL }}" + {{ with .Site.Params.socialProfiles }}, "sameAs": {{ . }}{{ end }} + {{ with .Site.Params.organizationLogo }}, "logo": "{{ . }}"{{ end }} + {{ with .Site.Params.organizationAddress }}, "address": "{{ . }}"{{ end }} + {{ with .Site.Data.organization.contacts.contactPoint }}, "contactPoint": {{ . }}{{ end }} +} +</script>
\ No newline at end of file diff --git a/themes/beautifulhugo/layouts/partials/seo/structured/post.html b/themes/beautifulhugo/layouts/partials/seo/structured/post.html new file mode 100644 index 0000000..f1a10da --- /dev/null +++ b/themes/beautifulhugo/layouts/partials/seo/structured/post.html @@ -0,0 +1,47 @@ +<script type="application/ld+json"> { + "@context" : "http://schema.org", + "@type" : "BlogPosting", + {{ if .Params.categories }}{{ range .Params.categories }}"articleSection" : "{{ . }}",{{ end }}{{ end }} + "name" : "{{ .Title | safeJS }}", + "headline" : "{{ .Title | safeJS }}", + "mainEntityOfPage": { + "@type": "WebPage", + "@id": "{{ .Permalink }}" + }, + "description" : "{{ if .Description }}{{ .Description | plainify }}{{ else }}{{if .IsPage}}{{ .Summary | plainify }}{{ end }}{{ end }}", + "inLanguage" : "{{ .Lang }}", + {{ if .Params.author -}} + "author": { + "@type": "Person", + "name": "{{ .Params.author }}" + }, + {{- else if .Site.Author.name -}} + "author": { + "@type": "Person", + "name": "{{ .Site.Author.name }}" + }, + {{- end }} + "copyrightYear" : "{{ .Site.Params.since }} - {{ .Site.LastChange.Format "2006" }}", + {{ if not .PublishDate.IsZero -}} + "datePublished": "{{ .PublishDate.Format "2006-01-02T15:04:05-07:00" | safeHTML }}", + {{- else if not .Date.IsZero -}} + "datePublished": "{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}", + {{- end }} + {{ with .Lastmod -}} + "dateModified": "{{ .Format "2006-01-02T15:04:05-07:00" | safeHTML }}", + {{- end }} + "url" : "{{ .Permalink }}", + "wordCount" : "{{ .WordCount }}", + "image" : "{{ .Site.Params.logo | absURL }}", + "keywords" : [ "{{ range $i, $e := .Params.tags }}{{ if $i }}, {{ end }}{{ $e }}{{ end }}" ], + "publisher" : { + "@type": "Organization", + "name" : "{{ .Site.BaseURL }}", + "logo" : { + "@type" : "ImageObject", + "url" : "{{ .Site.Params.logo | absURL }}", + "height" : 60 , + "width" : 60 + } + } +} </script>
\ No newline at end of file diff --git a/themes/beautifulhugo/layouts/partials/seo/structured/website.html b/themes/beautifulhugo/layouts/partials/seo/structured/website.html new file mode 100644 index 0000000..107e7fb --- /dev/null +++ b/themes/beautifulhugo/layouts/partials/seo/structured/website.html @@ -0,0 +1,9 @@ +<script type="application/ld+json"> +{ + "@context": "http://schema.org", + "@type": "WebSite", + "name": "{{ .Site.Title }}", + {{ with .Site.Params.alternatePageName }}"alternateName": "{{ . }}",{{ end }} + "url": "{{ .Site.BaseURL }}" +} +</script>
\ No newline at end of file diff --git a/themes/beautifulhugo/layouts/partials/seo/twitter.html b/themes/beautifulhugo/layouts/partials/seo/twitter.html new file mode 100644 index 0000000..0eb1e9b --- /dev/null +++ b/themes/beautifulhugo/layouts/partials/seo/twitter.html @@ -0,0 +1,14 @@ +{{- with .Title | default .Site.Title }} + <meta name="twitter:title" content="{{ . | truncate 70 }}" /> +{{- end }} +{{- 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 }} + <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 }}
\ No newline at end of file |