From 0293c122177bf8c595cda8b4dfb513d90b1e6b03 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Mon, 23 May 2022 22:25:13 -0700 Subject: [PATCH] feat: recent posts section/partial --- assets/styles/base.scss | 61 +++++++++++++++++---------------- data/config.yaml | 1 + layouts/index.html | 3 ++ layouts/partials/page-list.html | 6 ++++ layouts/partials/recent.html | 12 +++++++ 5 files changed, 54 insertions(+), 29 deletions(-) create mode 100644 layouts/partials/recent.html diff --git a/assets/styles/base.scss b/assets/styles/base.scss index de866fdbb..1c353f338 100644 --- a/assets/styles/base.scss +++ b/assets/styles/base.scss @@ -171,35 +171,6 @@ article { opacity: 0.7; } - & > .tags { - list-style: none; - padding-left: 0; - - & .meta { - & > h1 { - margin: 0; - } - & > p { - margin: 0; - } - } - - & > li { - display: inline-block; - margin: 0.4em 0; - } - & > li > a { - border-radius: 8px; - border: var(--outlinegray) 1px solid; - padding: 0.2em 0.5em; - &::before { - content: "#"; - margin-right: 0.3em; - color: var(--outlinegray); - } - } - } - & a { font-family: Source Sans Pro; font-weight: 600; @@ -223,6 +194,36 @@ article { } } +.tags { + list-style: none; + padding-left: 0; + + & .meta { + & > h1 { + margin: 0; + } + & > p { + margin: 0; + } + } + + & > li { + display: inline-block; + margin: 0.4em 0; + } + + & > li > a { + border-radius: 8px; + border: var(--outlinegray) 1px solid; + padding: 0.2em 0.5em; + &::before { + content: "#"; + margin-right: 0.3em; + color: var(--outlinegray); + } + } +} + .backlinks a { font-weight: 600; font-size: 0.9rem; @@ -590,3 +591,5 @@ header { padding: 0 1em; } } + + diff --git a/data/config.yaml b/data/config.yaml index 2b606e74e..b79ad5721 100644 --- a/data/config.yaml +++ b/data/config.yaml @@ -5,6 +5,7 @@ enableLinkPreview: true enableLatex: true enableSPA: true enableContextualBacklinks: true +enableRecentNotes: false description: Host your second brain and digital garden for free. Quartz features extremely fast full-text search, Wikilink support, backlinks, local graph, tags, and link previews. diff --git a/layouts/index.html b/layouts/index.html index 224c99784..8d1ffbd4f 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -15,6 +15,9 @@
{{partial "toc.html" .}} {{partial "textprocessing.html" . }} + {{if $.Site.Data.config.enableRecentNotes}} + {{partial "recent.html" . }} + {{end}}
{{partial "footer.html" .}} diff --git a/layouts/partials/page-list.html b/layouts/partials/page-list.html index 6c2249baf..e51c5ddab 100644 --- a/layouts/partials/page-list.html +++ b/layouts/partials/page-list.html @@ -4,11 +4,17 @@

{{- .Title -}}

+

{{- .Summary -}}{{if .Truncated}}...{{end}}

{{ .ReadingTime }} minute read. Last updated {{if ne .Date .Lastmod}}{{ .Lastmod.Format "January 2, 2006" }}{{else}}Unknown{{end}}

+
{{- end -}} diff --git a/layouts/partials/recent.html b/layouts/partials/recent.html new file mode 100644 index 000000000..e3926c243 --- /dev/null +++ b/layouts/partials/recent.html @@ -0,0 +1,12 @@ +
+

Recent Notes

+ + {{$notes := .Site.RegularPages}} + {{partial "page-list.html" (first 3 $notes)}} +
+