aboutsummaryrefslogtreecommitdiff
path: root/v2/src/bin/collection-for
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2023-04-10 16:18:01 -0300
committerEuAndreh <eu@euandre.org>2023-04-10 16:18:01 -0300
commit4b9cddca7f0f75e321319c79e94b3af3ce37e5ef (patch)
tree3cbbaba20deadebb9169c6c2a1ea65d984da05ae /v2/src/bin/collection-for
parentv2: <link /> to translated version in <head /> (diff)
downloadeuandre.org-4b9cddca7f0f75e321319c79e94b3af3ce37e5ef.tar.gz
euandre.org-4b9cddca7f0f75e321319c79e94b3af3ce37e5ef.tar.xz
v2: <link /> to collection feed inside <head>
Diffstat (limited to 'v2/src/bin/collection-for')
-rwxr-xr-xv2/src/bin/collection-for23
1 files changed, 12 insertions, 11 deletions
diff --git a/v2/src/bin/collection-for b/v2/src/bin/collection-for
index 87f1204..e46f345 100755
--- a/v2/src/bin/collection-for
+++ b/v2/src/bin/collection-for
@@ -71,16 +71,17 @@ eval "$(assert_arg "$FILE" 'FILE')"
lang="$(lang-for "$FILE")"
DIR="$(dirname "$FILE")"
-if [ "$DIR" = "$CONTENT_PREFIX/$lang" ]; then
- echo
+PAGE="${FILE%.*}.page"
+
+if [ -e "$PAGE" ]; then
+ exit 1
else
- NAME="$(basename "$DIR")"
- NTH="$(
- collections |
- xargs -I% coll2path "$lang" % |
- awk '{ print NR, substr($0, 1, length($0) - 1) }' |
- grep " $NAME$" |
- cut -d' ' -f1
- )"
- collections | awk -vNTH="$NTH" 'NR == NTH'
+ collections | awk -v l="$lang" -v pre="$CONTENT_PREFIX" -v dir="$DIR" '{
+ "coll2path " l " " $0 | getline coll_path
+ d = pre "/" l "/" coll_path
+ sub(/\/$/, "", d)
+ if (d == dir) {
+ print $0
+ }
+ }'
fi