aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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