2018-07-12 16:26:03 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2019-02-26 13:50:07 +00:00
|
|
|
PATH_TO_SITE="${1:-/app/site}"
|
|
|
|
|
2018-07-12 16:26:03 +00:00
|
|
|
set -eu
|
|
|
|
|
2022-04-15 14:16:08 +00:00
|
|
|
[ ! -d "${PATH_TO_SITE}" ] && echo "= Cannot check HTML content: no site asset found" && exit 1
|
2018-07-12 16:26:03 +00:00
|
|
|
|
|
|
|
NUMBER_OF_CPUS="$(grep -c processor /proc/cpuinfo)"
|
|
|
|
|
|
|
|
echo "=== Checking HTML content..."
|
|
|
|
|
|
|
|
# Search for all HTML files except the theme's partials
|
|
|
|
# and pipe this to htmlproofer with parallel threads
|
|
|
|
# (one htmlproofer per vCPU)
|
|
|
|
find "${PATH_TO_SITE}" -type f -not -path "/app/site/theme/*" \
|
2022-04-15 14:16:08 +00:00
|
|
|
-name "*.html" -print0 \
|
2018-07-12 16:26:03 +00:00
|
|
|
| xargs -0 -r -P "${NUMBER_OF_CPUS}" -I '{}' \
|
2022-04-15 14:16:08 +00:00
|
|
|
htmlproofer \
|
|
|
|
--check-html \
|
|
|
|
--check_external_hash \
|
|
|
|
--alt_ignore="/traefikproxy-vertical-logo-color.svg/" \
|
|
|
|
--http_status_ignore="0,500,501,503" \
|
|
|
|
--file_ignore="/404.html/" \
|
2022-05-16 08:00:08 +00:00
|
|
|
--url_ignore="/https://groups.google.com/a/traefik.io/forum/#!forum/security/,/localhost:/,/127.0.0.1:/,/fonts.gstatic.com/,/.minikube/,/github.com\/traefik\/traefik\/*edit*/,/github.com\/traefik\/traefik/,/doc.traefik.io/,/github\.com\/golang\/oauth2\/blob\/36a7019397c4c86cf59eeab3bc0d188bac444277\/.+/,/www.akamai.com/,/pilot.traefik.io\/profile/,/traefik.io/,/doc.traefik.io\/traefik-mesh/,/www.mkdocs.org/,/squidfunk.github.io/,/ietf.org/,/www.namesilo.com/,/www.youtube.com/,/www.linode.com/,/www.alibabacloud.com/,/www.cloudxns.net/,/www.vultr.com/,/vscale.io/,/hetzner.com/,/docs.github.com/,/njal.la/,/www.wedos.com/" \
|
2022-04-15 14:16:08 +00:00
|
|
|
'{}' 1>/dev/null
|
2018-07-12 16:26:03 +00:00
|
|
|
## HTML-proofer options at https://github.com/gjtorikian/html-proofer#configuration
|
|
|
|
|
2019-02-26 13:50:07 +00:00
|
|
|
echo "= Documentation checked successfully."
|