From e3b6780603ac38d0499a6d7c45b65f1cb5e0d827 Mon Sep 17 00:00:00 2001 From: "Kevin C. Coram" Date: Mon, 18 Nov 2019 23:39:28 -0500 Subject: [PATCH] Create basic layout structure Create basic layout structure by following along with the documentation from gohugo.io. In particular: * Basic Templates and Blocks (https://gohugo.io/templates/base/) * Content View Templates (https://gohugo.io/templates/views/) * Homepage Template (https://gohugo.io/templates/homepage/) --- layouts/_default/baseof.html | 32 +++++++++++++++++++++++--------- layouts/_default/list.html | 14 ++++++++++++++ layouts/_default/single.html | 10 ++++++++++ layouts/_default/summary.html | 12 ++++++++++++ layouts/index.html | 20 ++++++++++++++++++++ layouts/partials/footer.html | 5 +++++ layouts/partials/head.html | 0 layouts/partials/header.html | 2 ++ 8 files changed, 86 insertions(+), 9 deletions(-) create mode 100644 layouts/_default/summary.html delete mode 100644 layouts/partials/head.html diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 5f8e2ec..df03897 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,11 +1,25 @@ - {{- partial "head.html" . -}} - - {{- partial "header.html" . -}} -
- {{- block "main" . }}{{- end }} -
- {{- partial "footer.html" . -}} - - + + + + + {{ block "title" . }} + {{ .Site.Title }} + {{ end }} + + + + + + {{ partial "header.html" . }} + {{ block "main" . }} + + {{ end }} + {{ block "footer" . }} + + {{ partial "footer.html" . }} + {{ end }} + + + \ No newline at end of file diff --git a/layouts/_default/list.html b/layouts/_default/list.html index e69de29..e360eae 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -0,0 +1,14 @@ +{{/* This will override the default value set in baseof.html; i.e., "{{.Site.Title}}" in the original example */}} +{{ define "title" }} +{{ .Title }} – {{ .Site.Title }} +{{ end }} +{{ define "main" }} +
+
+

{{ .Title }}

+ {{ range .Pages }} + {{ .Render "summary"}} + {{ end }} +
+
+{{ end }} \ No newline at end of file diff --git a/layouts/_default/single.html b/layouts/_default/single.html index e69de29..519c4b2 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -0,0 +1,10 @@ +{{/* This will override the default value set in baseof.html; i.e., "{{.Site.Title}}" in the original example */}} +{{ define "title" }} +{{ .Title }} – {{ .Site.Title }} +{{ end }} +{{ define "main" }} +
+

{{ .Title }}

+ {{ .Content }} +
+{{ end }} \ No newline at end of file diff --git a/layouts/_default/summary.html b/layouts/_default/summary.html new file mode 100644 index 0000000..ae13901 --- /dev/null +++ b/layouts/_default/summary.html @@ -0,0 +1,12 @@ +
+
+

{{ .Title }}

+ +
+ {{ .Summary }} + +
\ No newline at end of file diff --git a/layouts/index.html b/layouts/index.html index e69de29..e60afe6 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -0,0 +1,20 @@ +{{ define "main" }} +
+
+

{{.Title}}

+ {{ with .Site.Params.Subtitle }} + {{.}} + {{ end }} +
+
+ + {{.Content}} +
+
+ + {{ range first 10 .Pages }} + {{ .Render "summary"}} + {{ end }} +
+
+{{ end }} \ No newline at end of file diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index e69de29..8b437a7 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/layouts/partials/head.html b/layouts/partials/head.html deleted file mode 100644 index e69de29..0000000 diff --git a/layouts/partials/header.html b/layouts/partials/header.html index e69de29..9c65a31 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -0,0 +1,2 @@ +
+
\ No newline at end of file