diff options
author | Simon <gevhaz@tutanota.com> | 2020-05-22 13:42:10 +0300 |
---|---|---|
committer | Simon <gevhaz@tutanota.com> | 2020-05-22 13:42:10 +0300 |
commit | eecf4fbf85412e626b8290673247f21d26f47464 (patch) | |
tree | 2829e047efe8102ef238eae8052106be5282ee39 | |
parent | 8e4d8d664b91b4bbf28f07e76a669cbf9412e078 (diff) |
Added Archive functionality
-rw-r--r-- | archetypes/archive.md | 4 | ||||
-rw-r--r-- | layouts/archive/list.html | 24 | ||||
-rw-r--r-- | layouts/post/list.html | 3 |
3 files changed, 31 insertions, 0 deletions
diff --git a/archetypes/archive.md b/archetypes/archive.md new file mode 100644 index 0000000..40890e4 --- /dev/null +++ b/archetypes/archive.md @@ -0,0 +1,4 @@ +--- +title: '{{ replace .Name "-" " " | title }}' +menu: "main" +--- diff --git a/layouts/archive/list.html b/layouts/archive/list.html new file mode 100644 index 0000000..f541a80 --- /dev/null +++ b/layouts/archive/list.html @@ -0,0 +1,24 @@ +{{ define "main" }} +<main> + +{{ with .Site.GetPage "section" "post" }} + {{- $byyear := (where .Pages ".Draft" false).GroupByDate "2006" -}} + + {{- range $byyear -}} + <h2>{{ .Key }}</h2> + + <ul> + {{ range.Pages }} + <li> <time>{{ .Date.Format "01/02" }}</time> + <span> - </span> + <a href="{{ .Permalink }}"> + <span>{{ .Title }}</span> + </a> + </li> + {{ end }} + </ul> + {{- end -}} +{{ end }} + +</main> +{{ end }} diff --git a/layouts/post/list.html b/layouts/post/list.html index 1689381..8ad45ef 100644 --- a/layouts/post/list.html +++ b/layouts/post/list.html @@ -3,6 +3,9 @@ <div class="taxonomy-links"> <ul> + {{ if (fileExists "content/archive/_index.md") }} + <li><a href="{{ "archive" | absURL }}">Archive</a></li> + {{ end }} <li><a href="{{ "categories" | absURL }}">Categories</a></li> <li><a href="{{ "tags" | absURL }}">Tags</a></li> </ul> |