From 76c251066fd34a26734bf1acdb1e041881e1c0af Mon Sep 17 00:00:00 2001 From: Alex Shpak Date: Sun, 25 Nov 2018 13:30:25 +0100 Subject: Refactor templates and partials --- layouts/404.html | 6 ++++-- layouts/docs/baseof.html | 13 +++---------- layouts/docs/list.html | 10 +++++++++- layouts/docs/single.html | 10 +++++++++- layouts/partials/docs/toc.html | 7 ++++++- layouts/posts/baseof.html | 2 +- layouts/posts/list.html | 10 ++++++---- layouts/posts/single.html | 6 ++++-- 8 files changed, 42 insertions(+), 22 deletions(-) (limited to 'layouts') diff --git a/layouts/404.html b/layouts/404.html index ca630ee..06ca617 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -2,7 +2,9 @@ {{ define "main"}}
-

Go Home

+

Go Home

-{{ end }} \ No newline at end of file +{{ end }} + +{{ define "toc" }} {{ end }} \ No newline at end of file diff --git a/layouts/docs/baseof.html b/layouts/docs/baseof.html index 0f951cd..805e060 100644 --- a/layouts/docs/baseof.html +++ b/layouts/docs/baseof.html @@ -28,21 +28,14 @@
{{ partial "docs/mobile-header" . }} -
- {{- .Content -}} -
+ {{ template "main" . }}
- {{ $showToC := default (default true .Site.Params.BookShowToC) .Params.bookshowtoc }} - {{ if and ($showToC) (.Page.TableOfContents) }} - - {{ end }} + {{ template "toc" . }} {{ partial "docs/inject/body" . }} {{ template "_internal/google_analytics_async.html" . }} - \ No newline at end of file + diff --git a/layouts/docs/list.html b/layouts/docs/list.html index a54943b..ee001c9 100644 --- a/layouts/docs/list.html +++ b/layouts/docs/list.html @@ -1 +1,9 @@ -{{ define "." }} {{ end }} \ No newline at end of file +{{ define "main" }} +
+ {{- .Content -}} +
+{{ end }} + +{{ define "toc" }} + {{ partial "docs/toc" . }} +{{ end }} diff --git a/layouts/docs/single.html b/layouts/docs/single.html index a54943b..ee001c9 100644 --- a/layouts/docs/single.html +++ b/layouts/docs/single.html @@ -1 +1,9 @@ -{{ define "." }} {{ end }} \ No newline at end of file +{{ define "main" }} +
+ {{- .Content -}} +
+{{ end }} + +{{ define "toc" }} + {{ partial "docs/toc" . }} +{{ end }} diff --git a/layouts/partials/docs/toc.html b/layouts/partials/docs/toc.html index aca3785..83c276d 100644 --- a/layouts/partials/docs/toc.html +++ b/layouts/partials/docs/toc.html @@ -1 +1,6 @@ -{{ .Page.TableOfContents }} \ No newline at end of file +{{ $showToC := default (default true .Site.Params.BookShowToC) .Params.bookshowtoc }} + {{ if and ($showToC) (.Page.TableOfContents) }} + +{{ end }} diff --git a/layouts/posts/baseof.html b/layouts/posts/baseof.html index 47371c0..fa97ee3 100644 --- a/layouts/posts/baseof.html +++ b/layouts/posts/baseof.html @@ -16,4 +16,4 @@ {{ template "_internal/google_analytics_async.html" . }} - \ No newline at end of file + diff --git a/layouts/posts/list.html b/layouts/posts/list.html index da13220..97873dd 100644 --- a/layouts/posts/list.html +++ b/layouts/posts/list.html @@ -5,14 +5,16 @@

{{ .Title }}

-
{{ .Date.Format "January 2, 2006" }}
+
+ {{ .Date.Format "January 2, 2006" }} +

- {{ .Summary }} + {{- .Summary -}} {{ if .Truncated }} - ... + ... {{ end }}

{{ end }} {{ template "_internal/pagination.html" . }} -{{ end }} \ No newline at end of file +{{ end }} diff --git a/layouts/posts/single.html b/layouts/posts/single.html index 9081faa..6b0712e 100644 --- a/layouts/posts/single.html +++ b/layouts/posts/single.html @@ -1,9 +1,11 @@ {{ define "main" }}

{{ .Title }}

-
{{ .Date.Format "January 2, 2006" }}
+
+ {{ .Date.Format "January 2, 2006" }} +
{{- .Content -}}
-{{ end }} \ No newline at end of file +{{ end }} -- cgit v1.2.3