Test generated website HTML for problems.
After Dark includes a source build of htmltest which may be used to analyze HTML generated for problems such as linkrot, meta attributes and more.
Code analysis is ideal for identifying potential 404 errors and determining when to link to the archived version of an external page which has gone offline.
To use install Docker then run the following command:
cd after-dark/docker/htmltest && docker build --rm .
Build container uses Alpine and includes
musl-dev for high-performance. Update the
HTMLTEST_VERSION to get a specific release built. Upon successful build extract the resulting binary out of the scratch container like:
docker create -it --name temp f2b785583ce8 sh && \ sudo docker cp temp:/htmltest /usr/local/bin && \ docker rm -fv temp
f2b785583ce8 is the scratch container’s Image ID and
/usr/local/bin is the destination on the host. Place executable in most appropriate directory.
If using Hugo
0.56.x or higher may also possible to include
htmltest as a Go module using
Hugo Modules if your particular use case calls for it.
See htmltest for documentation and usage.