summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAbdus <gh@abdus.net>2020-10-28 13:05:41 +0530
committerAbdus <gh@abdus.net>2020-10-28 13:05:41 +0530
commitcb0ad0579ee8ebf9d3ec0c27c4f854dc12e64645 (patch)
treec854e9ceccca8c581d134be95136f8c5187e0e47
parent724c92c2f0043f00c01985c042041bfe6e15f3d3 (diff)
downloadabdus.net-cb0ad0579ee8ebf9d3ec0c27c4f854dc12e64645.tar.bz2
abdus.net-cb0ad0579ee8ebf9d3ec0c27c4f854dc12e64645.zip
add SEO
-rw-r--r--themes/bronn/layouts/_default/single.html3
-rw-r--r--themes/bronn/layouts/partials/head.html50
-rw-r--r--themes/bronn/layouts/partials/json-ld.html26
3 files changed, 79 insertions, 0 deletions
diff --git a/themes/bronn/layouts/_default/single.html b/themes/bronn/layouts/_default/single.html
index d0427cf..a79c215 100644
--- a/themes/bronn/layouts/_default/single.html
+++ b/themes/bronn/layouts/_default/single.html
@@ -35,6 +35,9 @@
</div>
</main>
+{{ partial "json-ld.html" . }}
+
+<!--.-->
{{ if eq .Section "notes" }}
<script type="module">
import { annotate } from "https://unpkg.com/rough-notation?module";
diff --git a/themes/bronn/layouts/partials/head.html b/themes/bronn/layouts/partials/head.html
index 92311ff..0b69fb6 100644
--- a/themes/bronn/layouts/partials/head.html
+++ b/themes/bronn/layouts/partials/head.html
@@ -14,3 +14,53 @@
></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
+
+{{ if .Params.meta.description }}
+<!-- -->
+{{ .Scratch.Set "desc" .Params.meta.description }}
+<!-- -->
+{{ else }}
+<!-- -->
+{{ .Scratch.Set "desc" .Summary }}
+<!-- -->
+{{ end }}
+<!-- -->
+
+{{ if .Params.meta.image }}
+<!-- -->
+{{ .Scratch.Set "image" (.Params.meta.image | absURL) }}
+<!-- -->
+{{ else }}
+<!-- -->
+{{ .Scratch.Set "image" ("/images/default-meta-img.png" | absURL) }}
+<!-- -->
+{{ end }}
+
+<!-- Meta Tags -->
+<meta name="description" content='{{ .Scratch.Get "desc" }}' />
+<!-- -->
+
+<meta name="title" content="{{ .Page.Title }} | {{ .Site.Title }}" />
+<meta name="robots" content="index, follow" />
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<meta name="language" content="English" />
+<meta name="revisit-after" content="2 days" />
+
+<!-- Open Graph / Facebook -->
+<meta property="og:type" content="website" />
+<meta property="og:url" content="{{ .Permalink | absURL }}" />
+<meta property="og:title" content="{{ .Page.Title }} | {{ .Site.Title }}" />
+<meta property="og:description" content='{{ .Scratch.Get "desc" }}' />
+<meta property="og:image" content='{{ .Scratch.Get "image" }}' />
+
+<!-- Twitter -->
+<meta property="twitter:card" content="summary_large_image" />
+<meta property="twitter:url" content="{{ .Permalink | absURL }}" />
+<meta
+ property="twitter:title"
+ content="{{ .Page.Title }} | {{ .Site.Title }}"
+/>
+<meta property="twitter:description" content='{{ .Scratch.Get "desc" }}' />
+<meta property="twitter:image" content='{{ .Scratch.Get "image" }}' />
+
+<title>{{ .Page.Title }} | {{ .Site.Title }}</title>
diff --git a/themes/bronn/layouts/partials/json-ld.html b/themes/bronn/layouts/partials/json-ld.html
new file mode 100644
index 0000000..8d0281e
--- /dev/null
+++ b/themes/bronn/layouts/partials/json-ld.html
@@ -0,0 +1,26 @@
+<script type="application/ld+json">
+ {
+ "@context" : "http://schema.org",
+ "@type" : "BlogPosting",
+ "mainEntityOfPage": {
+ "@type": "WebPage",
+ "@id": "{{ .Site.BaseURL }}"
+ },
+ "articleSection" : "{{ .Section }}",
+ "name" : "{{ .Title }}",
+ "headline" : "{{ .Title }}",
+ "description" : "{{ if .Description }}{{ .Description }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ end }}{{ end }}",
+ "inLanguage" : "en-US",
+ "author" : "Abdus S. Azad",
+ "creator" : "Abdus S. Azad",
+ "publisher": "Abdus S. Azad",
+ "accountablePerson" : "Abdus S. Azad",
+ "copyrightHolder" : "Abdus S. Azad",
+ "copyrightYear" : "{{ .Date.Format "2006" }}",
+ "datePublished": "{{ .Date }}",
+ "dateModified" : "{{ .Date }}",
+ "url" : "{{ .Permalink }}",
+ "wordCount" : "{{ .WordCount }}",
+ "keywords" : [ {{ if isset .Params "tags" }}{{ range .Params.tags }}"{{ . }}",{{ end }}{{ end }}"Blog" ]
+ }
+</script>