From 836128c866e0ed67566a248492dd76b498672cbc Mon Sep 17 00:00:00 2001 From: leafee98 Date: Wed, 18 May 2022 19:45:04 +0800 Subject: [PATCH] _index.md's content is shown at list page --- exampleSite/content/essays/_index.md | 2 + layouts/_default/list.html | 60 +++++++++++++++------------- layouts/_default/term.html | 60 +++++++++++++++------------- layouts/partials/header.html | 2 +- static/css/style.css | 46 ++++++++++++--------- 5 files changed, 96 insertions(+), 74 deletions(-) diff --git a/exampleSite/content/essays/_index.md b/exampleSite/content/essays/_index.md index dcded25..0c5c49b 100644 --- a/exampleSite/content/essays/_index.md +++ b/exampleSite/content/essays/_index.md @@ -8,3 +8,5 @@ draft: false --- + +*There are some short articles.* diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 393c3c1..1c0d36d 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,33 +1,39 @@ {{ define "main" }} -
- {{ range .Data.Pages.GroupByDate "2006" }} -
-

- {{ .Key }} -

- - {{ range .Pages }} -
- - -
- - {{ .Title }} - - {{ with .Params.tags }} - {{ range . }} - {{ . }} - {{ end }} - {{ end }} - -
-
- {{ end }} - -
+
+ {{ if trim .Content " \n" }} +
{{ .Content }}
{{ end }} -
+
+ {{ range .Data.Pages.GroupByDate "2006" }} +
+

+ {{ .Key }} +

+ + {{ range .Pages }} +
+ + +
+ + {{ .Title }} + + {{ with .Params.tags }} + {{ range . }} + {{ . }} + {{ end }} + {{ end }} + +
+
+ {{ end }} + +
+ {{ end }} + +
+ {{ end }} diff --git a/layouts/_default/term.html b/layouts/_default/term.html index 393c3c1..1c0d36d 100644 --- a/layouts/_default/term.html +++ b/layouts/_default/term.html @@ -1,33 +1,39 @@ {{ define "main" }} -
- {{ range .Data.Pages.GroupByDate "2006" }} -
-

- {{ .Key }} -

- - {{ range .Pages }} -
- - -
- - {{ .Title }} - - {{ with .Params.tags }} - {{ range . }} - {{ . }} - {{ end }} - {{ end }} - -
-
- {{ end }} - -
+
+ {{ if trim .Content " \n" }} +
{{ .Content }}
{{ end }} -
+
+ {{ range .Data.Pages.GroupByDate "2006" }} +
+

+ {{ .Key }} +

+ + {{ range .Pages }} +
+ + +
+ + {{ .Title }} + + {{ with .Params.tags }} + {{ range . }} + {{ . }} + {{ end }} + {{ end }} + +
+
+ {{ end }} + +
+ {{ end }} + +
+ {{ end }} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 8f36795..fcb544f 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -1,5 +1,5 @@
-
+
{{ .Site.Title }}