Skip to content

Commit

Permalink
Update link checking scripts / targets (kedacore#696)
Browse files Browse the repository at this point in the history
  • Loading branch information
chalin authored Mar 7, 2022
1 parent 00736bc commit e03e0d2
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 7 deletions.
4 changes: 3 additions & 1 deletion .htmltest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ DirectoryPath: public
IgnoreDirectoryMissingTrailingSlash: true
CheckExternal: false
IgnoreAltMissing: true
IgnoreEmptyHref: true
IgnoreEmptyHref: true
IgnoreInternalURLs:
- /docs/2.6/scalers/solace-pub-sub/ # Due to https://github.com/kedacore/keda-docs/issues/693
33 changes: 27 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
HTMLTEST_DIR=tmp
HTMLTEST?=htmltest # Specify as make arg if different
HTMLTEST_ARGS?=--skip-external

DOCS=public/docs
LATEST_VERSION=$(shell grep -e '^docs' config.toml | grep -oe '\d\.\d' | head -1)
LATEST_VERSION2=`grep -e '^docs' config.toml | grep -oe '\d\.\d' | head -1`

# Use $(HTMLTEST) in PATH, if available; otherwise, we'll get a copy
ifeq (, $(shell which $(HTMLTEST)))
override HTMLTEST=$(HTMLTEST_DIR)/bin/htmltest
ifeq (, $(shell which $(HTMLTEST)))
GET_LINK_CHECKER_IF_NEEDED=get-link-checker
endif
endif

build: clean
hugo -e development -DFE

clean:
rm -rf public/* resources
rm -rf $(HTMLTEST_DIR) public/* resources

serve:
hugo server \
Expand All @@ -23,10 +39,15 @@ preview-build: clean
open:
open https://keda.sh

link-checker-setup:
curl https://htmltest.wjdp.uk | bash
check-links: $(GET_LINK_CHECKER_IF_NEEDED) make-redirects-for-checking
$(HTMLTEST) $(HTMLTEST_ARGS)
find public/* -type l -ls -exec rm -f {} \;

run-link-checker:
bin/htmltest
make-redirects-for-checking:
@echo "Creating symlinks of 'latest' to $(LATEST_VERSION) for the purpose of link checking"
(cd public && rm -f scalers && ln -s docs/$(LATEST_VERSION)/scalers scalers)
(cd public/docs && rm -f latest && ln -s $(LATEST_VERSION) latest)

check-links: link-checker-setup run-link-checker
get-link-checker:
rm -Rf $(HTMLTEST_DIR)/bin
curl https://htmltest.wjdp.uk | bash -s -- -b $(HTMLTEST_DIR)/bin

0 comments on commit e03e0d2

Please sign in to comment.