summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2020-08-12 06:34:38 -0300
committerEuAndreh <eu@euandre.org>2020-08-12 06:56:04 -0300
commit191728a2cac217e96a7f1e4e9a4710606f6ad920 (patch)
treebbcf9c17bb3bd462f8d1c41169d1122b08161d18 /scripts
parentassert-content.sh: Look at post refs too, not only pages (diff)
downloadeuandre.org-191728a2cac217e96a7f1e4e9a4710606f6ad920.tar.gz
euandre.org-191728a2cac217e96a7f1e4e9a4710606f6ad920.tar.xz
Add TILs section, with Atom support and i18n
- add i18n logic to support translated TIL entries and listing; - make the website title less tied to a blog: "EuAndreh::blog" -> <web>EuAndreh</web>; - remove old Atom feed link aliases; - remove feed.all.atom and it's link in the about page; - create Atom feed for TIL entries; - show blog and TIL Atom feed on their listing pages (index and tils-listing); - add root alias: / -> /en/ - remove explicit list of feeds from $IGNORED_PAGES and use a '*.atom' glob instead; - also lint, assert-content and assert-unique-ref of TILs; - fix wrong "post.date" in pastebin entry in site.json;
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/assert-content.sh13
1 files changed, 11 insertions, 2 deletions
diff --git a/scripts/assert-content.sh b/scripts/assert-content.sh
index 7448c61..d83ec33 100755
--- a/scripts/assert-content.sh
+++ b/scripts/assert-content.sh
@@ -34,7 +34,8 @@ get-ref() {
}
get-url() {
- echo "${1}" | base64 --decode | jq -r .url
+ # Remove leading / to match more closely the filesystem hierarchy
+ echo "${1}" | base64 --decode | jq -r .url | sed 's_^/__'
}
get-date() {
@@ -69,7 +70,7 @@ for post in $(jq -r '.posts[] | @base64' "${JSON}"); do
done
echo Linting pages... >&2
-IGNORED_PAGES=(/site.json /sitemap.xml /rss.xml /atom.xml /feed.atom /feed.xml /feed.all.atom /feed.en.atom /feed.pt.atom)
+IGNORED_PAGES=(site.json sitemap.xml *.atom)
for page in $(jq -r '.pages[] | @base64' "${JSON}"); do
URL="$(get-url "$page")"
if ! contains-element "${URL}" "${IGNORED_PAGES[@]}"; then
@@ -82,6 +83,11 @@ for pastebin in $(jq -r '.pastebins[] | @base64' "${JSON}"); do
assert-frontmatter "$pastebin"
done
+echo Linting tils... >&2
+for til in $(jq -r '.tils[] | @base64' "${JSON}"); do
+ assert-frontmatter "$til"
+done
+
echo Asserting unique refs... >&2
KNOWN_IDS=()
assert-unique-ref() {
@@ -96,6 +102,8 @@ assert-unique-ref() {
printf '%s\n' "${KNOWN_IDS[@]}"
red "Duplicated lang:ref match: '${ID}'." >&2
red "Page: ${URL}." >&2
+ echo "$page" | base64 --decode | jq
+
exit 1
fi
@@ -106,5 +114,6 @@ assert-unique-ref() {
assert-unique-ref "$(jq -r '.pages[] | @base64' "${JSON}")"
assert-unique-ref "$(jq -r '.posts[] | @base64' "${JSON}")"
+assert-unique-ref "$(jq -r '.tils[] | @base64' "${JSON}")"
echo Done. >&2