maintainer-docs/check-links.sh
Otto Liljalaakso a34a137860 Improve check-links.sh
1. linkchecker had removed option `--complete`, so have to remove it
   from here as well.

2. Many errors were not actionable, because they came from Docs
   stylesheet. Add `--ignore-url` entries to silence such errors.
2024-07-04 21:39:42 +03:00

33 lines
1.5 KiB
Bash
Executable file

#!/bin/sh
# Stylesheet's 'Edit this file' generates file links
PATTERN_FILE_URL='^file:///'
# Stylesheet's language selector generated links with 'en-US' language tag
PATTERN_EN_US='^http://localhost:8080/en-US/package-maintainers/'
# These three are in stylesheet footer
PATTERN_LEGAL='^http://localhost:8080/legal/$'
PATTERN_PRIVACY='^http://localhost:8080/legal/privacy/$'
PATTERN_COC='^http://localhost:8080/project/code-of-conduct/$'
PATTERN_SPONSORS='^https://getfedora.org/en/sponsors/$'
PATTERN_CC_BYSA='^http://creativecommons.org/licenses/by-sa/4.0/legalcode$'
PATTERN_LICENSING='^https://fedoraproject.org/wiki/Licensing'
PATTERN_FEDORA_RHEL='^https://www.redhat.com/en/technologies/linux-platforms/articles/relationship-between-fedora-and-rhel$'
# Stylesheet CSS generates this
PATTERN_FONT='^http://localhost:8080/_/font/'
# Major weakness: Is not able to check xref's to other Fedora Docs pages.
# If other pages are not added to site.yml, the xrefs render as text.
# If other pages are added to site.yml, this checker checks also links from those other pages.
linkchecker http://localhost:8080 \
--check-extern \
--ignore-url $PATTERN_FILE_URL \
--ignore-url $PATTERN_EN_US \
--ignore-url $PATTERN_LEGAL \
--ignore-url $PATTERN_PRIVACY \
--ignore-url $PATTERN_COC \
--ignore-url $PATTERN_SPONSORS \
--ignore-url $PATTERN_CC_BYSA \
--ignore-url $PATTERN_LICENSING \
--ignore-url $PATTERN_FEDORA_RHEL \
--ignore-url $PATTERN_FONT \