aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2020-08-12 09:58:34 -0300
committerEuAndreh <eu@euandre.org>2020-08-12 10:00:23 -0300
commitdf357d62bbf2aca388864ee789e779da79f49f53 (patch)
treee2406a6f048d79eac1807bd51585bcc4ea25d4c7 /scripts
parentAdd title to pages missing it (diff)
downloadeuandre.org-df357d62bbf2aca388864ee789e779da79f49f53.tar.gz
euandre.org-df357d62bbf2aca388864ee789e779da79f49f53.tar.xz
scripts/assert-content.sh: Add check for missing title
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/assert-content.sh12
1 files changed, 11 insertions, 1 deletions
diff --git a/scripts/assert-content.sh b/scripts/assert-content.sh
index d466b05..d8fe89f 100755
--- a/scripts/assert-content.sh
+++ b/scripts/assert-content.sh
@@ -42,7 +42,13 @@ get-date() {
echo "${1}" | base64 --decode | jq -r .date
}
+get-title() {
+ echo "${1}" | base64 --decode | jq -r .title
+}
+
LANGS=(en pt)
+IGNORED_PAGES=(site.json sitemap.xml *.atom)
+
assert-frontmatter() {
F="${1}"
LANG="$(get-lang "$F")"
@@ -50,6 +56,11 @@ assert-frontmatter() {
URL="$(get-url "$F")"
[[ -z "${LANG}" ]] && fail-attr 'lang' "${URL}"
[[ -z "${REF}" ]] && fail-attr 'ref' "${URL}"
+ if ! contains-element "${URL}" "${IGNORED_PAGES[@]}"; then
+ TITLE="$(get-title "$F")"
+ [[ -z "${TITLE}" ]] && fail-attr 'title' "${URL}"
+ fi
+
if ! contains-element "${LANG}" "${LANGS[@]}"; then
red "Invalid lang '${LANG}' in ${URL}." >&2
exit 1
@@ -70,7 +81,6 @@ for post in $(jq -r '.posts[] | @base64' "${JSON}"); do
done
echo Linting pages... >&2
-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