From c1783b4a10b468974c74a8b2f9265f8dc33ef220 Mon Sep 17 00:00:00 2001 From: Daniel-I-Am Date: Sat, 11 Jun 2022 16:48:58 +0200 Subject: [PATCH] Refactor and add list of snippets --- layouts/index.html | 22 ++------------------ layouts/partials/snippet-list.html | 22 ++++++++++++++++++++ layouts/snippets/list.html | 33 ++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 20 deletions(-) create mode 100644 layouts/partials/snippet-list.html create mode 100644 layouts/snippets/list.html diff --git a/layouts/index.html b/layouts/index.html index 1715683..28bc712 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,24 +1,6 @@ {{ define "main" }}
-
-

Latest Articles

- -
-
-
    - {{ range ( first 3 (where .Site.RegularPages "Type" "snippets").ByDate.Reverse ) }} -
  • - Article Topic -
    -

    {{ .Title }}

    - -
    -
  • - {{ end }} -
-
+ {{ partial "snippet-list" (dict "showAllArticles" true) }}
{{ end }} @@ -48,4 +30,4 @@ -{{ end }} \ No newline at end of file +{{ end }} diff --git a/layouts/partials/snippet-list.html b/layouts/partials/snippet-list.html new file mode 100644 index 0000000..cb1aacb --- /dev/null +++ b/layouts/partials/snippet-list.html @@ -0,0 +1,22 @@ +
+

Latest Articles

+ + {{ if index $ "showAllArticles" }} + + {{ end }} +
+
+ +
diff --git a/layouts/snippets/list.html b/layouts/snippets/list.html new file mode 100644 index 0000000..c1d2f2d --- /dev/null +++ b/layouts/snippets/list.html @@ -0,0 +1,33 @@ +{{ define "main" }} +
+ {{ partial "snippet-list" (dict) }} +
+{{ end }} + +{{ define "aside" }} + +{{ end }}