Skip to content

Commit

Permalink
[build] comments fix
Browse files Browse the repository at this point in the history
  • Loading branch information
traceypooh committed Jan 26, 2025
1 parent a0ef866 commit 8d210d7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bin/sitemap
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/bin/zsh -e

mydir=${0:a:h}

if [ ! -e config.yml ]; then
echo run this script from the top-level of your repo
exit 1
Expand Down Expand Up @@ -100,18 +98,20 @@ function rss() { # xxx <description> using snippet??
function comments() {
# this helps with efficiency but could be replaced with a lot of requests at runtime in the browser
(
cd $mydir/..
echo -n Updating comments
mkdir -p comments
cd comments
find . -mindepth 1 -type d |cut -b3- |sort -o index.txt
for DIR in $(cat index.txt); do
echo -n .
OUT=$DIR/index.json
rm -f $OUT
jq -rs '. | map(.)' $DIR/*.json \
| jq '.[] | del(.replyThread) | with_entries(if .key == "_id" then .key = "id" else . end)' \
| jq -s 'flatten(1)' \
> $OUT
done
echo
)
}

Expand Down

0 comments on commit 8d210d7

Please sign in to comment.