From 896326481e86fa9a5a5e2b49b478a8a871315495 Mon Sep 17 00:00:00 2001 From: vimux Date: Sat, 3 Nov 2018 10:23:41 -0400 Subject: [PATCH] Define Base Template (baseof.html) --- layouts/404.html | 14 ++++++------- layouts/_default/baseof.html | 39 ++++++++++++++++++++++++++++++++++++ layouts/_default/list.html | 22 +++++++------------- layouts/_default/single.html | 38 +++++++++++++++++------------------ layouts/index.html | 38 +++++++++++++++++------------------ layouts/partials/footer.html | 7 +------ layouts/partials/header.html | 30 ++++----------------------- 7 files changed, 93 insertions(+), 95 deletions(-) create mode 100644 layouts/_default/baseof.html diff --git a/layouts/404.html b/layouts/404.html index b030795..5d5132a 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -1,9 +1,7 @@ -{{ partial "header.html" . }} -
-
-

{{ T "page404_title" }}

-

{{ T "page404_lead" }}

- {{ T "page404_link" }} -
+{{ define "main" }} +
+

{{ T "page404_title" }}

+

{{ T "page404_lead" }}

+ {{ T "page404_link" }}
-{{ partial "footer.html" . }} \ No newline at end of file +{{ end }} \ No newline at end of file diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html new file mode 100644 index 0000000..b0cc70d --- /dev/null +++ b/layouts/_default/baseof.html @@ -0,0 +1,39 @@ + + + + + + + + {{ if not .IsHome }}{{ .Title }} | {{ end }}{{ .Site.Title }} + + {{ with .Site.Params.author }}{{ end }} + {{ if .Site.Params.opengraph }}{{ template "_internal/opengraph.html" . }}{{ end }} + {{ if .Site.Params.twitter_cards }}{{ template "_internal/twitter_cards.html" . }}{{ end }} + + + + {{ with .OutputFormats.Get "rss" -}} + {{ printf `` .Rel .MediaType.Type .RelPermalink $.Site.Title | safeHTML }} + {{ end -}} + + {{ if not .Site.IsServer }}{{ template "_internal/google_analytics_async.html" . }}{{ end }} + + + {{ partial "header" . }} +
+ {{ block "main" . }} + {{- if or .Title .Content }} +
+ {{ with .Title }}

{{ . }}

{{ end }} + {{ with .Content }}
{{ . }}
{{ end }} +
+ {{ end }} + {{ end }} +
+ {{ partial "footer" . }} + + +{{- partial "mathjax.html" . -}} + + \ No newline at end of file diff --git a/layouts/_default/list.html b/layouts/_default/list.html index f8fecf4..bd8a291 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,18 +1,10 @@ -{{ partial "header.html" . }} -
- {{- if or .Title .Content }} -
- {{ with .Title }}

{{ . }}

{{ end }} - {{ with .Content }}
{{ . }}
{{ end }} +{{ define "main" }} +
+ {{ range .Paginator.Pages }} +
+ {{ .Render "summary" }}
{{ end }} -
- {{ range .Paginator.Pages }} -
- {{ .Render "summary" }} -
- {{ end }} -
- {{ partial "pagination.html" . }}
-{{ partial "footer.html" . }} \ No newline at end of file + {{ partial "pagination.html" . }} +{{ end }} \ No newline at end of file diff --git a/layouts/_default/single.html b/layouts/_default/single.html index bc9d6ef..b841ac2 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,21 +1,19 @@ -{{ partial "header.html" . }} -
-
-
- {{- partial "post_thumbnail.html" (dict "page" . ) }} - -

{{ .Title }}

- {{- partial "post_toc.html" . }} -
{{ .Content }}
- {{ if or (.Param "share") (isset $.Params "tags") }} -
- {{ partial "post_tags.html" . }} - {{ partial "post_share.html" . }} -
- {{ end }} -
-
- {{ partial "related.html" . }} - {{ partial "comments.html" . }} +{{ define "main" }} +
+
+ {{- partial "post_thumbnail.html" (dict "page" . ) }} + +

{{ .Title }}

+ {{- partial "post_toc.html" . }} +
{{ .Content }}
+ {{ if or (.Param "share") (isset $.Params "tags") }} +
+ {{ partial "post_tags.html" . }} + {{ partial "post_share.html" . }} +
+ {{ end }} +
-{{ partial "footer.html" . }} \ No newline at end of file + {{ partial "related.html" . }} + {{ partial "comments.html" . }} +{{ end }} \ No newline at end of file diff --git a/layouts/index.html b/layouts/index.html index 2e06036..6ec6de9 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,22 +1,20 @@ -{{ partial "header.html" . }} -
-
- {{ $mainSections := .Site.Params.mainSections | default (slice "post") }} - {{ $paginator := .Paginate ( where .Data.Pages "Section" "in" $mainSections ) }} - {{ range $paginator.Pages }} -
- {{ .Render "summary" }} -
- {{ end }} +{{ define "main" }} +
+ {{ $mainSections := .Site.Params.mainSections | default (slice "post") }} + {{ $paginator := .Paginate ( where .Data.Pages "Section" "in" $mainSections ) }} + {{ range $paginator.Pages }} +
+ {{ .Render "summary" }}
- {{- if eq $paginator.TotalNumberOfElements 0 }} -
-
¯\_(ツ)_/¯
-

{{ T "empty_title" }}

-

{{ T "empty_text_start" | safeHTML }} ({{ delimit (apply $mainSections "printf" "content/%s" ".") ", " | safeHTML }}), {{ T "empty_text_end" }}.

-

{{ T "empty_tip" | safeHTML }}

-
- {{- end }} - {{ partial "pagination.html" . }} + {{ end }}
-{{ partial "footer.html" . }} \ No newline at end of file + {{- if eq $paginator.TotalNumberOfElements 0 }} +
+
¯\_(ツ)_/¯
+

{{ T "empty_title" }}

+

{{ T "empty_text_start" | safeHTML }} ({{ delimit (apply $mainSections "printf" "content/%s" ".") ", " | safeHTML }}), {{ T "empty_text_end" }}.

+

{{ T "empty_tip" | safeHTML }}

+
+ {{- end }} + {{ partial "pagination.html" . }} +{{ end }} \ No newline at end of file diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 540ec97..5e3e2cd 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -1,9 +1,4 @@
{{- partial "footer_social.html" . }} -
- - -{{- partial "mathjax.html" . -}} - - \ No newline at end of file + \ No newline at end of file diff --git a/layouts/partials/header.html b/layouts/partials/header.html index ea0490a..b92a3c2 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -1,26 +1,4 @@ - - - - - - - - {{ if not .IsHome }}{{ .Title }} | {{ end }}{{ .Site.Title }} - - {{ with .Site.Params.author }}{{ end }} - {{ if .Site.Params.opengraph }}{{ template "_internal/opengraph.html" . }}{{ end }} - {{ if .Site.Params.twitter_cards }}{{ template "_internal/twitter_cards.html" . }}{{ end }} - - - - {{ with .OutputFormats.Get "rss" -}} - {{ printf `` .Rel .MediaType.Type .RelPermalink $.Site.Title | safeHTML }} - {{ end -}} - - {{ if not .Site.IsServer }}{{ template "_internal/google_analytics_async.html" . }}{{ end }} - - -
- - {{ partial "menu.html" . }} -
\ No newline at end of file +
+ + {{ partial "menu.html" . }} +
\ No newline at end of file