Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/bul-ikana/hugo-cards.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorosjupiter <neko.10osama+github@gmail.com>2019-04-04 19:09:44 +0300
committerosjupiter <neko.10osama+github@gmail.com>2019-04-05 14:55:08 +0300
commit16cc43476050e8d92aa728c1e5bdab2782461e65 (patch)
tree8146621467ad923a6ee66eeb5677e5ccea4f99c5
parentdf6ceff8341b0165b9d0d8f3f5f3089027eba26b (diff)
add seo file
-rw-r--r--layouts/partials/head.html1
-rw-r--r--layouts/partials/seo.html54
2 files changed, 55 insertions, 0 deletions
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index e38bac6..f1853f4 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -4,6 +4,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ .Title}}{{if .IsPage}} - {{.Site.Title}}{{ end }}</title>
+{{partial "seo.html" .}}
{{ $main := resources.Get "sass/main.scss" | resources.ToCSS (dict "outputStyle" "compressed")}}
<link rel="stylesheet" href="{{ $main.RelPermalink }}">
diff --git a/layouts/partials/seo.html b/layouts/partials/seo.html
new file mode 100644
index 0000000..817da4e
--- /dev/null
+++ b/layouts/partials/seo.html
@@ -0,0 +1,54 @@
+<meta name="description" content="{{ if .Description }}{{ .Description | plainify }}{{ else }}{{if .IsPage}}{{ .Summary | plainify }}{{ end }}{{ end }}"/>
+<meta name="robots" content="noodp"/>
+<link rel="canonical" href="{{ .Permalink }}" />
+
+<!-- Twitter Card -->
+<meta name="twitter:card" content="summary" />
+<meta name="twitter:description" content="{{ if .Description }}{{ .Description | plainify }}{{ else }}{{if .IsPage}}{{ .Summary | plainify }}{{ end }}{{ end }}" />
+<meta name="twitter:title" content="{{ .Title }}{{ if .IsHome }} - {{ .Site.Params.Tagline }}{{ else }} - {{ .Site.Title }}{{ end }}" />
+<meta name="twitter:site" content="{{ .Site.Params.twitter }}" />
+<meta name="twitter:creator" content="{{ .Site.Params.twitter }}" />
+
+<!-- OG data -->
+<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" />
+<meta content="{{ .Title }}{{ if .IsHome }} - {{ .Site.Params.Tagline }}{{ else }} - {{ .Site.Title }}{{ end }}" property="og:title">
+<meta content="{{ if .Description }}{{ .Description | plainify }}{{ else }}{{if .IsPage}}{{ .Summary | plainify }}{{ end }}{{ end }}" property="og:description">
+<meta property="og:url" content="{{ .Permalink }}" />
+<meta property="og:site_name" content="{{ .Site.Title }}" />
+{{ range .Params.categories }}<meta property="article:section" content="{{ . }}" />{{ end }}
+{{ if isset .Params "date" }}<meta property="article:published_time" content="{{ time .Date }}" />{{ end }}
+
+<!-- JSON-LD -->
+{{ if .IsHome }}
+<script type="application/ld+json">
+{
+ "@context": "http://schema.org",
+ "@type": "WebSite",
+ "url": "{{ .Permalink }}",
+ "name": "{{ .Site.Title }}",
+ "author": {
+ "@type": "Person",
+ "name": "{{ .Site.Params.author }}"
+ },
+ "description": "{{ .Site.Params.description }}",
+}
+</script>
+{{ end }}
+
+{{ if .IsPage }}
+<script type="application/ld+json">
+{
+ "@context": "http://schema.org",
+ "@type": "BlogPosting",
+ "headline": "{{ .Title }}",
+ "genre": "{{ range .Params.categories }}{{ . }}{{ end }}",
+ "url": "{{ .Permalink }}",
+ "datePublished": "{{ time .Date }}",
+ "description": "{{ if .Description }}{{ .Description | plainify }}{{ else }}{{if .IsPage}}{{ .Summary | plainify }}{{ end }}{{ end }}",
+ "author": {
+ "@type": "Person",
+ "name": "{{ .Site.Author.name }}"
+ }
+ }
+</script>
+{{ end }}