diff options
author | Volpeon <git@volpeon.ink> | 2020-12-30 09:55:37 +0100 |
---|---|---|
committer | Volpeon <git@volpeon.ink> | 2020-12-30 09:55:37 +0100 |
commit | 8132f5172d286ef73f5d0f2cfbd95da713870484 (patch) | |
tree | 0aa9ae8cee715f4d5d654e8e87fad5662a9e6ce8 | |
parent | Revert to old category metadata collection, add support for authors (diff) | |
download | volpeon.ink-8132f5172d286ef73f5d0f2cfbd95da713870484.tar.gz volpeon.ink-8132f5172d286ef73f5d0f2cfbd95da713870484.tar.bz2 volpeon.ink-8132f5172d286ef73f5d0f2cfbd95da713870484.zip |
Fixed finding subpages in some cases, use multiple sorted arrays for categories
-rwxr-xr-x | scripts/build_content.sh | 5 | ||||
-rw-r--r-- | templates/base.html | 6 | ||||
-rw-r--r-- | templates/categoriesByCount.html | 7 | ||||
-rw-r--r-- | templates/categoriesById.html (renamed from templates/categoryRef.html) | 4 |
4 files changed, 14 insertions, 8 deletions
diff --git a/scripts/build_content.sh b/scripts/build_content.sh index fc5ddea..78857b5 100755 --- a/scripts/build_content.sh +++ b/scripts/build_content.sh | |||
@@ -67,7 +67,8 @@ get_section() { | |||
67 | 67 | ||
68 | get_subpages_basedir() { | 68 | get_subpages_basedir() { |
69 | filename=$1 | 69 | filename=$1 |
70 | if [ "${filename##*/}" = "index.md" ]; then | 70 | filename=${filename%.md} |
71 | if [ "${filename##*/}" = "index" ]; then | ||
71 | filename=$(dirname "$filename") | 72 | filename=$(dirname "$filename") |
72 | fi | 73 | fi |
73 | echo "$filename" | 74 | echo "$filename" |
@@ -165,7 +166,7 @@ get_subpages_meta() { | |||
165 | | .by_year |= (to_entries | sort_by(.key) | reverse \ | 166 | | .by_year |= (to_entries | sort_by(.key) | reverse \ |
166 | | .[].value |= (sort_by(.date) | reverse))") | 167 | | .[].value |= (sort_by(.date) | reverse))") |
167 | 168 | ||
168 | categories=$(echo "$categories" | jq ". | to_entries | sort_by(.key)") | 169 | categories=$(echo "$categories" | jq ". | to_entries | { by_id: (. | sort_by(.key)), by_count: (. | sort_by(.value.count) | reverse) }") |
169 | 170 | ||
170 | echo "{}" | jq ". + { \ | 171 | echo "{}" | jq ". + { \ |
171 | pages: $pages, \ | 172 | pages: $pages, \ |
diff --git a/templates/base.html b/templates/base.html index 4b8ea1e..48d7c72 100644 --- a/templates/base.html +++ b/templates/base.html | |||
@@ -52,10 +52,8 @@ ${pageHeader()} | |||
52 | $body$ | 52 | $body$ |
53 | 53 | ||
54 | $if(section.is_blog)$ | 54 | $if(section.is_blog)$ |
55 | $if(pages.not_empty)$ | 55 | ${categoriesById()} |
56 | ${categoryRef()} | 56 | ${pagelistByYear()} |
57 | ${pagelistByYear()} | ||
58 | $endif$ | ||
59 | $endif$ | 57 | $endif$ |
60 | </div> | 58 | </div> |
61 | </main> | 59 | </main> |
diff --git a/templates/categoriesByCount.html b/templates/categoriesByCount.html new file mode 100644 index 0000000..871e3db --- /dev/null +++ b/templates/categoriesByCount.html | |||
@@ -0,0 +1,7 @@ | |||
1 | $if(categories.by_count)$ | ||
2 | <ul class="c-hlist"> | ||
3 | $for(categories.by_count)$ | ||
4 | <li class="c-hlist__item"><strong>$it.key/uppercase$</strong>: $it.value.name$ ($it.value.count$)</li> | ||
5 | $endfor$ | ||
6 | </ul> | ||
7 | $endif$ | ||
diff --git a/templates/categoryRef.html b/templates/categoriesById.html index 58dc5fe..1f4f433 100644 --- a/templates/categoryRef.html +++ b/templates/categoriesById.html | |||
@@ -1,6 +1,6 @@ | |||
1 | $if(categories)$ | 1 | $if(categories.by_id)$ |
2 | <ul class="c-hlist"> | 2 | <ul class="c-hlist"> |
3 | $for(categories)$ | 3 | $for(categories.by_id)$ |
4 | <li class="c-hlist__item"><strong>$it.key/uppercase$</strong>: $it.value.name$ ($it.value.count$)</li> | 4 | <li class="c-hlist__item"><strong>$it.key/uppercase$</strong>: $it.value.name$ ($it.value.count$)</li> |
5 | $endfor$ | 5 | $endfor$ |
6 | </ul> | 6 | </ul> |