summaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
authorAlexandre Vicenzi <vicenzi.alexandre@gmail.com>2020-10-17 14:40:58 +0200
committerAlexandre Vicenzi <vicenzi.alexandre@gmail.com>2020-10-17 14:40:58 +0200
commitb607c6857a95b49df2e71042b82b41ca15d26eb3 (patch)
treec6dda838ab985454d1ca1bd06a32c231d5ecf1d9 /layouts
parentcd5751ef1425db3ed7e46fcaa7fafe53e494c286 (diff)
Layout improvements
- Tagline - Share buttons - JSON LD - Tags - Style Fixes
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/baseof.html4
-rw-r--r--layouts/_default/single.html11
-rw-r--r--layouts/partials/footer.html16
-rw-r--r--layouts/partials/json-ld.html134
-rw-r--r--layouts/partials/seo.html2
-rw-r--r--layouts/partials/share.html31
-rw-r--r--layouts/partials/tags.html13
7 files changed, 203 insertions, 8 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 6de94f0..57ef293 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -66,6 +66,10 @@
integrity="sha256-MAgcygDRahs+F/Nk5Vz387whB4kSK9NXlDN3w58LLq0="
crossorigin="anonymous"></script>
+
+ <script src="{{ `js/jquery.min.js` | relURL }}"></script>
+ <script src="{{ `js/soho.js` | relURL }}"></script>
+
{{ range $.Site.Params.customJs -}}
<script src="{{ . | relURL }}"></script>
{{- end}}
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 611a77f..bb342dc 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -1,6 +1,7 @@
{{ define "main" -}}
<div class="post">
- <h1>{{ .Title }}</h1>
+ <h1 class="title">{{ .Title }}</h1>
+ {{ with .Params.tagline }}<span class="tagline">{{ . }}</span>{{ end }}
{{ if ne .Type "page" -}}
<div class="post-date">
@@ -8,7 +9,15 @@
</div>
{{- end }}
+ <div>
{{ .Content }}
+ </div>
+
+ {{ partial "tags.html" . }}
+
+ {{ if (and (ne .Params.DisableShare true) (ne .Params.disable_share true)) -}}
+ {{ partial "share.html" . }}
+ {{- end }}
</div>
{{ if (and .Site.DisqusShortname (ne .Params.DisableComments true) (ne .Params.disable_comments true)) -}}
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index dbedee0..416ebd5 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -1,13 +1,15 @@
<footer>
<div>
- &copy; {{ $.Site.Params.Copyright }} {{ now.Format "2006"}}
+ <p>
+ &copy; {{ $.Site.Params.Copyright }} {{ now.Format "2006"}}
- {{ with $.Site.Params.License -}}
- &middot; <a href="{{ $.Site.Params.licenseURL }}" target="_blank">{{ . | safeHTML }}</a>
- {{- end }}
+ {{ with $.Site.Params.License -}}
+ &middot; <a href="{{ $.Site.Params.licenseURL }}" target="_blank">{{ . | safeHTML }}</a>
+ {{- end }}
- {{ with $.Site.Params.BuiltWith -}}
- &middot; Build with <a href="https://gohugo.io/" target="_blank">Hugo</a> & <a href="https://themes.gohugo.io/soho/" target="_blank">Soho</a> theme
- {{- end }}
+ {{ with $.Site.Params.BuiltWith -}}
+ &middot; Build with <a href="https://gohugo.io/" target="_blank">Hugo</a> & <a href="https://themes.gohugo.io/soho/" target="_blank">Soho</a> theme
+ {{- end }}
+ </p>
</div>
</footer>
diff --git a/layouts/partials/json-ld.html b/layouts/partials/json-ld.html
new file mode 100644
index 0000000..3976d43
--- /dev/null
+++ b/layouts/partials/json-ld.html
@@ -0,0 +1,134 @@
+{{ $ISO8601 := "2006-01-02T15:04:05-07:00" }}
+<script type="application/ld+json">
+{
+ "@context": "https://schema.org",
+ "@graph": [
+ {
+ "@type":"Person",
+ "@id": {{ .Site.BaseURL | printf "%s#author" }},
+ "name": {{ .Site.Params.author }},
+ "image": {
+ "@type":"ImageObject",
+ {{ with .Site.Params.gravatar -}}
+ "url": {{ md5 . | printf `"https://www.gravatar.com/avatar/%s?s=400&d=mp"` | safeJS }}
+ {{- else }}
+ {{ with .Site.Params.profilePicture -}}
+ "url": {{ . | absURL | printf `"%s"` | safeJS }}
+ {{ end -}}
+ {{ end }}
+ },
+ "description": {{ .Site.Params.description }}
+ },
+ {
+ "@type": "WebSite",
+ "@id": {{ .Site.BaseURL | printf "%s#website" }},
+ "url": {{ .Site.BaseURL }},
+ "name": {{ .Site.Title }},
+ "description": {{ .Site.Params.description }},
+ "publisher": {
+ "@id": {{ $.Site.BaseURL | printf "%s#author" }}
+ },
+ "inLanguage": {{ .Site.LanguageCode }}
+ },
+ {{- with .Site.Params.images -}}
+ {{- range . }}
+ {
+ "@type": "ImageObject",
+ "url": {{ . | absURL | printf `"%s"` | safeJS }},
+ "caption": {{ $.Site.Title }}
+ },
+ {{- end }}
+ {{- end }}
+ {
+ "@type": "WebPage",
+ "@id": {{ .Permalink | printf "%s#webpage" }},
+ "url": {{ .Permalink }},
+ "name": {{ .Title }},
+ "isPartOf": {
+ "@id": {{ .Site.BaseURL | printf "%s#website" }}
+ },
+ "about": {
+ "@id": {{ .Site.BaseURL | printf "%s#author" }}
+ },
+ {{- if not .PublishDate.IsZero }}
+ "datePublished": {{ .PublishDate.Format $ISO8601 }},
+ {{- end }}
+ {{- if not .Lastmod.IsZero }}
+ "dateModified": {{ .Lastmod.Format $ISO8601 }},
+ {{- end }}
+ "description": {{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }},
+ "inLanguage": {{ .Site.LanguageCode }},
+ "potentialAction": [
+ {
+ "@type": "ReadAction",
+ "target": [
+ {{ .Permalink }}
+ ]
+ }
+ ]
+ }{{ if .IsPage }},
+ {
+ "@type": "Article",
+ "isPartOf": {
+ "@id": {{ .Permalink | printf "%s#webpage" }}
+ },
+ "mainEntityOfPage": {
+ "@id": {{ .Permalink | printf "%s#webpage" }}
+ },
+ "headline": {{ .Title }},
+ {{- with .Params.images }}
+ "image": [
+ {{- range $idx, $url := . -}}{{- if $idx -}},{{- end }}
+ {{ $url | absURL -}}
+ {{ end }}
+ ],
+ {{- end }}
+ {{- if not .PublishDate.IsZero }}
+ "datePublished": {{ .PublishDate.Format $ISO8601 }},
+ {{- end }}
+ {{- if not .Lastmod.IsZero }}
+ "dateModified": {{ .Lastmod.Format $ISO8601 }},
+ {{- end }}
+ "publisher": {
+ "@id": {{ .Site.BaseURL | printf "%s#author" }}
+ },
+ "keywords": [
+ {{- if isset .Params "tags" -}}
+ {{- range $idx, $cat := .Params.tags -}}
+ {{- with $.Site.GetPage "tags" -}}
+ {{- with .GetPage $cat -}}{{- if $idx -}},{{- end }}
+ {{ .Title -}}
+ {{ end -}}
+ {{- end -}}
+ {{- end -}}
+ {{- end }}
+ ],
+ "articleSection": [
+ {{- if isset .Params "categories" -}}
+ {{- range $idx, $cat := .Params.categories -}}
+ {{- with $.Site.GetPage "categories" -}}
+ {{- with .GetPage $cat -}}{{- if $idx -}},{{- end }}
+ {{ .Title -}}
+ {{ end -}}
+ {{- end -}}
+ {{- end -}}
+ {{- end }}
+ ],
+ "inLanguage": {{ .Site.LanguageCode }},
+ "author": {
+ "@type": "Person",
+ "name": {{ .Params.author }}
+ },
+ "potentialAction": [
+ {
+ "@type": "CommentAction",
+ "name": "Comment",
+ "target": [
+ {{ .Permalink | printf "%s#comments" }}
+ ]
+ }
+ ]
+ }{{ end }}
+ ]
+}
+</script>
diff --git a/layouts/partials/seo.html b/layouts/partials/seo.html
index 96d56d5..8043b66 100644
--- a/layouts/partials/seo.html
+++ b/layouts/partials/seo.html
@@ -5,3 +5,5 @@
{{ template "_internal/twitter_cards.html" . }}
{{ template "_internal/opengraph.html" . }}
+
+{{ partial "json-ld.html" . }}
diff --git a/layouts/partials/share.html b/layouts/partials/share.html
new file mode 100644
index 0000000..67ceb40
--- /dev/null
+++ b/layouts/partials/share.html
@@ -0,0 +1,31 @@
+<div class="share-buttons">
+ <a class="twitter-share-button"
+ href="#"
+ title="Share on Twitter"
+ data-url="{{ .Permalink }}"
+ data-text="{{ .Title }}"><i class="fab fa-twitter"></i></a>
+
+ <a class="linkedin-share-button"
+ href="#"
+ title="Share on LinkedIn"
+ data-url="{{ .Permalink }}"
+ data-text="{{ .Title }}"><i class="fab fa-linkedin-in"></i></a>
+
+ <a class="facebook-share-button"
+ href="#"
+ title="Share on Facebook"
+ data-url="{{ .Permalink }}"
+ data-text="{{ .Title }}"><i class="fab fa-facebook"></i></a>
+
+ <a class="telegram-share-button"
+ href="#"
+ title="Share on Telegram"
+ data-url="{{ .Permalink }}"
+ data-text="{{ .Title }}"><i class="fab fa-telegram"></i></a>
+
+ <a class="pinterest-share-button"
+ href="#"
+ title="Share on Pinterest"
+ data-url="{{ .Permalink }}"
+ data-text="{{ .Title }}"><i class="fab fa-pinterest"></i></a>
+</div>
diff --git a/layouts/partials/tags.html b/layouts/partials/tags.html
new file mode 100644
index 0000000..8423d9a
--- /dev/null
+++ b/layouts/partials/tags.html
@@ -0,0 +1,13 @@
+<div>
+ <ul class="tags">
+ {{- range $tag := $.Params.tags -}}
+ {{- with $.Site.GetPage "tags" -}}
+ {{- with .GetPage $tag }}
+ <li>
+ <a href="{{ .Permalink }}" class="tag-link">{{ .Title }}</a>
+ </li>
+ {{ end -}}
+ {{- end -}}
+ {{- end -}}
+ </ul>
+</div>