summaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/single.html127
-rw-r--r--layouts/partials/head.html2
-rw-r--r--layouts/partials/opengraph.html (renamed from layouts/_internal/opengraph.html)10
3 files changed, 69 insertions, 70 deletions
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 6869a46..209524e 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -7,70 +7,69 @@
{{ end }}
<div {{ if .Param "autonumber" }} class="autonumber" {{ end }}>
-
- <div class="single-intro-container">
-
- {{/* Title and Summary */}}
-
- <h1 class="single-title">{{ .Title }}</h1>
- {{ with .Param "summary" }}
- <p class="single-summary">{{ . | markdownify }}</p>
- {{ end }}
-
- {{/* Reading Time */}}
-
- <p class="single-readtime">
- {{ with .Date }}
- {{ $dateMachine := . | time.Format "2006-01-02T15:04:05-07:00" }}
- {{ $dateHuman := . | time.Format (default ":date_long" $.Site.Params.singleDateFormat) }}
- <time datetime="{{ $dateMachine }}">{{ $dateHuman }}</time>
- {{end}}
-
- {{ if .Param "readTime" }}
- &nbsp; · &nbsp;
- {{ .ReadingTime }} min read
- {{end }}
- </p>
-
- </div>
-
- {{ if .Param "showTags" }}
-
- {{ $taxonomy := "tags" }}
- {{ with .Param $taxonomy }}
-
- <div class="single-tags">
- {{ range $index, $tag := . }}
- {{ with $.Site.GetPage (printf "/%s/%s" $taxonomy $tag) -}}
- <span>
- <a href="{{ .Permalink }}">#{{ .LinkTitle }}</a>
- </span>
- {{ end }}
- {{ end }}
- </div>
-
- {{ end }}
- {{ end }}
-
- {{/* Table of Content */}}
-
- {{ if .Param "toc" }}
- <aside class="toc">
- <p><strong>Table of contents</strong></p>
- {{ .TableOfContents }}
- </aside>
- {{ end }}
-
- {{/* Page content */}}
-
- <div class="single-content">
- {{ .Content }}
- {{ if .Site.Params.giscus.enable }}
- {{ if not .Params.disableComment }}
- {{ partial "comments.html" . }}
- {{ end }}
- {{ end }}
- </div>
+ <article>
+ <header class="single-intro-container">
+ {{- /* Title and Summary */}}
+
+ <h1 class="single-title">{{ .Title }}</h1>
+ {{- with .Param "summary" }}
+ <p class="single-summary">{{ . | markdownify }}</p>
+ {{- end }}
+
+ {{- /* Reading Time */}}
+
+ <p class="single-readtime">
+ {{- with .Date }}
+ {{- $dateMachine := . | time.Format "2006-01-02T15:04:05-07:00" }}
+ {{- $dateHuman := . | time.Format (default ":date_long" $.Site.Params.singleDateFormat) }}
+ <time datetime="{{ $dateMachine }}">{{ $dateHuman }}</time>
+ {{- end }}
+
+ {{- if .Param "readTime" }}
+ &nbsp; · &nbsp;
+ {{- .ReadingTime }} min read
+ {{- end }}
+ </p>
+ </header>
+
+ {{- if .Param "showTags" }}
+ {{- $taxonomy := "tags" }}
+ {{- with .Param $taxonomy }}
+ <div class="single-tags">
+ {{- range $index, $tag := . }}
+ {{- with $.Site.GetPage (printf "/%s/%s" $taxonomy $tag) -}}
+ <span>
+ <a href="{{ .Permalink }}">#{{ .LinkTitle }}</a>
+ </span>
+ {{- end }}
+ {{- end }}
+ </div>
+ {{- end }}
+ {{- end }}
+
+ {{- /* Table of Contents */}}
+
+ {{- if .Param "toc" }}
+ <aside class="toc">
+ <p><strong>Table of contents</strong></p>
+ {{ .TableOfContents }}
+ </aside>
+ {{- end }}
+
+ {{- /* Page content */}}
+
+ <div class="single-content">
+ {{ .Content }}
+ </div>
+ </article>
+
+ {{- /* Comments */}}
+
+ {{- if and .Site.Params.giscus.enable (not .Params.disableComment) }}
+ <div class="single-comments">
+ {{ partial "comments.html" . }}
+ </div>
+ {{- end }}
{{ if .Store.Get "hasMermaid" }}
{{ $mermaidDarkTheme := default "dark" (or .Params.mermaidDarkTheme .Site.Params.mermaidDarkTheme) }}
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index 80b3fa4..751abd2 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -36,7 +36,7 @@
<link rel="canonical" href="{{ .Permalink }}"/>
-{{ template "_internal/opengraph.html" . }}
+{{ template "partials/opengraph.html" . }}
{{ partialCached "head/css.html" . }}
{{ partialCached "head/js.html" . }}
diff --git a/layouts/_internal/opengraph.html b/layouts/partials/opengraph.html
index dfe7b08..d770df1 100644
--- a/layouts/_internal/opengraph.html
+++ b/layouts/partials/opengraph.html
@@ -44,7 +44,7 @@
{{- range . | first 6 }}
<meta property="og:image" content="{{ .Permalink }}">
{{- end }}
-{{- else -}}
+{{- else }}
{{- /*
Source modified to load `assets/images/og-image.{webp,png,jpg}` files if any of them exists.
@@ -52,11 +52,11 @@
as using an external service.
*/ -}}
- {{- if (and (or .IsHome .IsPage) (templates.Exists "partials/head/og-image.html")) -}}
- {{- $ogImage := partial "head/og-image.html" . -}}
- {{- with $ogImage -}}
+ {{- if templates.Exists "partials/head/og-image.html" }}
+ {{- $ogImage := partial "head/og-image.html" . | strings.TrimSpace }}
+ {{- with $ogImage }}
<meta property="og:image" content="{{ . }}">
- {{- end -}}
+ {{- end }}
{{- end }}
{{- end }}