diff options
author | Volpeon <git@volpeon.ink> | 2020-12-31 21:59:58 +0100 |
---|---|---|
committer | Volpeon <git@volpeon.ink> | 2020-12-31 21:59:58 +0100 |
commit | 1caccddbdfb2c1102be1a1da29f6a03e64695abe (patch) | |
tree | 4c1543a2a251c9f6d3ea90ccb9c403bc4e555478 /scripts | |
parent | Add last_update metadata to pages (diff) | |
download | volpeon.ink-1caccddbdfb2c1102be1a1da29f6a03e64695abe.tar.gz volpeon.ink-1caccddbdfb2c1102be1a1da29f6a03e64695abe.tar.bz2 volpeon.ink-1caccddbdfb2c1102be1a1da29f6a03e64695abe.zip |
Revert to old subpage find commands, include page content in feed
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/build_content.sh | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/scripts/build_content.sh b/scripts/build_content.sh index 17532f5..4e1b396 100755 --- a/scripts/build_content.sh +++ b/scripts/build_content.sh | |||
@@ -85,12 +85,20 @@ get_subpages_meta() { | |||
85 | child_pages=() | 85 | child_pages=() |
86 | 86 | ||
87 | if [ -d "$basedir" ]; then | 87 | if [ -d "$basedir" ]; then |
88 | mapfile -d $'\0' child_pages < <(find $basedir/ \ | 88 | mapfile -d $'\0' child_pages_1 < <(find $basedir/ \ |
89 | -type f \ | 89 | -type f \ |
90 | -name "*.md" \ | 90 | -name "*.md" ! -name "index.md" \ |
91 | ! -wholename "$basedir/index.md" \ | 91 | -maxdepth 1 \ |
92 | -print0) | ||
93 | |||
94 | mapfile -d $'\0' child_pages_2 < <(find $basedir/ \ | ||
95 | -type f \ | ||
96 | -name "index.md" \ | ||
97 | -mindepth 2 \ | ||
92 | -maxdepth 2 \ | 98 | -maxdepth 2 \ |
93 | -print0) | 99 | -print0) |
100 | |||
101 | child_pages=("${child_pages_1[@]}" "${child_pages_2[@]}") | ||
94 | fi | 102 | fi |
95 | 103 | ||
96 | pages=$(echo "{}" | jq ". + { \ | 104 | pages=$(echo "{}" | jq ". + { \ |
@@ -107,7 +115,7 @@ get_subpages_meta() { | |||
107 | #echo -e "\033[0;90m[////////]\033[0m - $file" | 115 | #echo -e "\033[0;90m[////////]\033[0m - $file" |
108 | 116 | ||
109 | metadata=$(get_metadata "$file") | 117 | metadata=$(get_metadata "$file") |
110 | # content=$(get_content "$file") | 118 | content=$(get_content "$file") |
111 | 119 | ||
112 | section=$(get_section "$file") | 120 | section=$(get_section "$file") |
113 | 121 | ||
@@ -140,13 +148,8 @@ get_subpages_meta() { | |||
140 | category_name=$(echo "$CATEGORIES" | jq -r .$section.$category) | 148 | category_name=$(echo "$CATEGORIES" | jq -r .$section.$category) |
141 | fi | 149 | fi |
142 | 150 | ||
143 | # metadata=$(echo "$metadata" | jq ". + { \ | ||
144 | # content: { \ | ||
145 | # plain: \"$(echo "$content" | sed -z 's/\\/\\\\/g;s/\n/\\n/g;s/"/\"/g')\", \ | ||
146 | # }, \ | ||
147 | # }") | ||
148 | |||
149 | metadata=$(echo "$metadata" | jq ". + { \ | 151 | metadata=$(echo "$metadata" | jq ". + { \ |
152 | content: \"$(echo "$content" | sed -z 's/\\/\\\\/g;s/\n/\\n/g;s/"/\"/g')\", \ | ||
150 | date: { \ | 153 | date: { \ |
151 | yyyy_mm_dd: \"$date\", \ | 154 | yyyy_mm_dd: \"$date\", \ |
152 | rfc3339: \"$date_rfc3339\" \ | 155 | rfc3339: \"$date_rfc3339\" \ |