From 04ce6eb512e3a52145dfeed8acc8a0b77616abce Mon Sep 17 00:00:00 2001 From: wangbudui Date: Tue, 7 Jan 2020 14:05:49 +0800 Subject: [PATCH] list almost done --- themes/hugo-w2ng/assets/css/styles.css | 2 +- themes/hugo-w2ng/layouts/_default/list.html | 26 +++++++++++++--- themes/hugo-w2ng/layouts/_default/single.html | 30 +++++-------------- themes/hugo-w2ng/layouts/partials/meta.html | 24 +++++++++++++++ 4 files changed, 54 insertions(+), 28 deletions(-) create mode 100644 themes/hugo-w2ng/layouts/partials/meta.html diff --git a/themes/hugo-w2ng/assets/css/styles.css b/themes/hugo-w2ng/assets/css/styles.css index 5d2826e..be87a1d 100644 --- a/themes/hugo-w2ng/assets/css/styles.css +++ b/themes/hugo-w2ng/assets/css/styles.css @@ -8,7 +8,7 @@ @import "node_modules/tailwindcss/utilities"; .markdown h1 { - @apply text-4xl my-12; + @apply text-3xl my-12; } .markdown h2 { @apply text-2xl my-8; diff --git a/themes/hugo-w2ng/layouts/_default/list.html b/themes/hugo-w2ng/layouts/_default/list.html index 3dfaa73..3b7cb0a 100644 --- a/themes/hugo-w2ng/layouts/_default/list.html +++ b/themes/hugo-w2ng/layouts/_default/list.html @@ -1,7 +1,25 @@ {{ define "main" }} -{{ range .Pages }} -
-

{{ .Title }}

+
+ {{- $pctx := . -}} + {{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} + {{- $pages := $pctx.RegularPages -}} + + {{ range (where $pages "Section" "!=" "") }} +
+ {{- partial "meta.html" . -}} +

{{ .Title }}

+ +
+ {{ if .Description }} + {{ .Description | markdownify }} + {{ else }} + {{ if .Truncated }} + {{ .Summary | truncate 150 | markdownify }}... + {{ end }} + {{ end }} +
-{{ end }} + {{ end }} +
{{ end }} \ No newline at end of file diff --git a/themes/hugo-w2ng/layouts/_default/single.html b/themes/hugo-w2ng/layouts/_default/single.html index 7b39499..7ac27ea 100644 --- a/themes/hugo-w2ng/layouts/_default/single.html +++ b/themes/hugo-w2ng/layouts/_default/single.html @@ -1,10 +1,11 @@ {{ define "main" }}
{{ if .IsPage }} -
-

{{ .Title }}

+
+ {{- partial "meta.html" . -}} +

{{ .Title }}

{{ if not .Params.disableMeta }} -

+

{{ with $.Site.Params.AuthorName }} {{ end }}

-

- {{ with .Params.categories }} - - {{ range . }} - {{ . }} - {{ end }} - - {{ end }} - {{ if .Params.categories }} / {{ end }} - {{ with .Params.tags }} - - {{ range . }} - - {{ end }} - - {{ end }} -

{{ end }} -
+ {{ end }} {{ if not .IsHome }}
{{ end }} -
+
{{ .Content }} -
+
{{ end }} \ No newline at end of file diff --git a/themes/hugo-w2ng/layouts/partials/meta.html b/themes/hugo-w2ng/layouts/partials/meta.html new file mode 100644 index 0000000..b7cb3e1 --- /dev/null +++ b/themes/hugo-w2ng/layouts/partials/meta.html @@ -0,0 +1,24 @@ +
+ {{ with .Params.categories }} +
    + {{ range . }} +
  • {{ . }}
  • + {{ end }} +
+ {{ end }} + {{ with .Params.tags }} + + {{ end }} +
\ No newline at end of file