From 0c237ca3390e05ea3899d26aaf45106fc8c5d61a Mon Sep 17 00:00:00 2001 From: Jeanette Date: Wed, 23 Oct 2019 12:06:54 -0700 Subject: [PATCH] adding layouts directory with theme modifications from default ananke theme these files change the font, width, and color of some columns --- layouts/_default/list.html | 15 ++++++ layouts/_default/single.html | 60 ++++++++++++++++++++++++ layouts/index.html | 55 ++++++++++++++++++++++ layouts/page/single.html | 18 +++++++ layouts/partials/summary-with-image.html | 29 ++++++++++++ layouts/post/list.html | 21 +++++++++ layouts/post/summary-with-image.html | 19 ++++++++ 7 files changed, 217 insertions(+) create mode 100755 layouts/_default/list.html create mode 100755 layouts/_default/single.html create mode 100755 layouts/index.html create mode 100644 layouts/page/single.html create mode 100644 layouts/partials/summary-with-image.html create mode 100644 layouts/post/list.html create mode 100644 layouts/post/summary-with-image.html diff --git a/layouts/_default/list.html b/layouts/_default/list.html new file mode 100755 index 00000000..9454e6cf --- /dev/null +++ b/layouts/_default/list.html @@ -0,0 +1,15 @@ +{{ define "main" }} +
+
+ {{- .Content -}} +
+
+ {{ range .Paginator.Pages }} +
+ {{- partial "summary.html" . -}} +
+ {{ end }} +
+ {{- template "_internal/pagination.html" . -}} +
+{{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html new file mode 100755 index 00000000..7bd539d6 --- /dev/null +++ b/layouts/_default/single.html @@ -0,0 +1,60 @@ +{{ define "header" }} + {{/* We can override any block in the baseof file be defining it in the template */}} + {{ partial "page-header.html" . }} +{{ end }} + +{{ define "main" }} + {{ $section := .Site.GetPage "section" .Section }} +
+ +
+

+ {{/* + CurrentSection allows us to use the section title instead of inferring from the folder. + https://gohugo.io/variables/page/#section-variables-and-methods + */}} + {{with .CurrentSection.Title }}{{. | upper }}{{end}} +

+

+ {{- .Title -}} +

+ {{ with .Params.author }} +

+ By {{ . | markdownify }} +

+ {{ end }} + {{/* Hugo uses Go's date formatting is set by example. Here are two formats */}} + + {{/* + Show "reading time" and "word count" but only if one of the following are true: + 1) A global config `params` value is set `show_reading_time = true` + 2) A section front matter value is set `show_reading_time = true` + 3) A page front matter value is set `show_reading_time = true` + */}} + {{ if (or (eq (.Param "show_reading_time") true) (eq $section.Params.show_reading_time true) )}} + - {{ .ReadingTime}} minutes read + - {{ .WordCount}} words + {{ end }} +
+ + + + + +
+{{ end }} diff --git a/layouts/index.html b/layouts/index.html new file mode 100755 index 00000000..91741bdd --- /dev/null +++ b/layouts/index.html @@ -0,0 +1,55 @@ +{{ define "main" }} +
+ {{ .Content }} +
+ {{/* Define a section to pull recent posts from. For Hugo 0.20 this will default to the section with the most number of pages. */}} + {{ $mainSections := .Site.Params.mainSections | default (slice "post") }} + {{/* Create a variable with that section to use in multiple places. */}} + {{ $section := where .Site.RegularPages "Section" "in" $mainSections }} + {{/* Check to see if the section is defined for ranging through it */}} + {{ $section_count := len $section }} + {{ if ge $section_count 1 }} + {{/* Derive the section name */}} + {{ $section_name := index (.Site.Params.mainSections) 0 }} + +
+ {{/* Use $section_name to get the section title. Use "with" to only show it if it exists */}} + {{ with .Site.GetPage "section" $section_name }} +

+ {{ $.Param "recent_copy" | default (i18n "recentTitle" .) }} +

+ {{ end }} + + {{ $n_posts := $.Param "recent_posts_number" | default 3 }} + +
+ {{/* Range through the first $n_posts items of the section */}} + {{ range (first $n_posts $section) }} +
+ {{ partial "summary-with-image.html" . }} +
+ {{ end }} +
+ + {{ if ge $section_count (add $n_posts 1) }} +
+

{{ i18n "more" }}

+ {{/* Now, range through the next four after the initial $n_posts items. Nest the requirements, "after" then "first" on the outside */}} + {{ range (first 4 (after $n_posts $section)) }} +

+ + {{ .Title }} + +

+ {{ end }} + + {{/* As above, Use $section_name to get the section title, and URL. Use "with" to only show it if it exists */}} + {{ with .Site.GetPage "section" $section_name }} + {{ i18n "allTitle" . }} + {{ end }} +
+ {{ end }} + +
+ {{ end }} +{{ end }} diff --git a/layouts/page/single.html b/layouts/page/single.html new file mode 100644 index 00000000..623df88e --- /dev/null +++ b/layouts/page/single.html @@ -0,0 +1,18 @@ +{{ define "header" }}{{ partial "page-header.html" . }}{{ end }} +{{ define "main" }} +
+
+
+

+ {{ humanize .Section | upper }} +

+

+ {{ .Title }} +

+
+ +
+
+{{ end }} diff --git a/layouts/partials/summary-with-image.html b/layouts/partials/summary-with-image.html new file mode 100644 index 00000000..67563f93 --- /dev/null +++ b/layouts/partials/summary-with-image.html @@ -0,0 +1,29 @@ +{{ $featured_image := .Params.featured_image }} +
+
+
+ {{ if .Params.featured_image }} + {{/* Trimming the slash and adding absURL make sure the image works no matter where our site lives */}} + {{ $featured_image := (trim $featured_image "/") | absURL }} +
+ + image from {{ .Title }} + +
+ {{ end }} +
+

+ + {{ .Title }} + +

+ + {{ $.Param "read_more_copy" | default (i18n "readMore") }} + {{/* TODO: add author +

By {{ .Author }}

*/}} +
+
+
+
diff --git a/layouts/post/list.html b/layouts/post/list.html new file mode 100644 index 00000000..07e85cfd --- /dev/null +++ b/layouts/post/list.html @@ -0,0 +1,21 @@ +{{ define "main" }} +{{/* + This template is the same as the default and is here to demonstrate that if you have a content directory called "post" you can create a layouts directory, just for that section. + */}} +
+
+ {{ .Content }} +
+ + {{ template "_internal/pagination.html" . }} +
+{{ end }} diff --git a/layouts/post/summary-with-image.html b/layouts/post/summary-with-image.html new file mode 100644 index 00000000..5ffad58a --- /dev/null +++ b/layouts/post/summary-with-image.html @@ -0,0 +1,19 @@ +
+ +
+ {{ if .Params.featured_image }} +
+ image from {{ .Title }} +
+ {{ end }} +
+

{{ .Title }}

+
+ {{ .Summary }} +
+ {{/* TODO: add author +

By {{ .Author }}

*/}} +
+
+
+