diff --git a/layouts/index.html b/layouts/index.html index f092e13..4a00120 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,5 +1,5 @@ {{ define "main" }} -{{ partial "snippet-list" (dict "showAllArticles" true) }} +{{ partial "snippet-list" (dict "showViewAllButton" true) }} {{ end }} {{ define "aside" }} diff --git a/layouts/partials/generic-list.html b/layouts/partials/generic-list.html new file mode 100644 index 0000000..d3e8e32 --- /dev/null +++ b/layouts/partials/generic-list.html @@ -0,0 +1,30 @@ +{{ $labelSingular := index $ "labelSingular" }} +{{ $labelPlural := or (index $ "labelPlural") (print $labelSingular "s") }} +{{ $maximumListSize := or (index $ "maximumListSize") 3 }} +{{ $pageType := index $ "pageType"}} +{{ $viewAllHref := or (index $ "viewAllHref") (print "/" $labelPlural) }} + +
+
+

Latest {{ $labelPlural | title }}

+ + {{ if index $ "showViewAllButton" }} + + {{ end }} +
+
+ +
+
diff --git a/layouts/partials/snippet-list.html b/layouts/partials/snippet-list.html index fcc5806..e950664 100644 --- a/layouts/partials/snippet-list.html +++ b/layouts/partials/snippet-list.html @@ -1,24 +1,3 @@ -
-
-

Latest Articles

+{{ $showViewAllButton := or (index $ "showViewAllButton") false }} - {{ if index $ "showAllArticles" }} - - {{ end }} -
-
- -
-
+{{ partial "generic-list" (dict "labelSingular" "snippet" "pageType" "snippets" "showViewAllButton" $showViewAllButton) }}