How to validate HTML and other quality testing with jekyll?

I occassionally test the validity of my site’s HTML using validator.w3.org.

I do this manually in a browser and fix whatever problems there may be.

I currently use a Makefile to build my jekyll sites.
In this Makefile I also have tests that run some link checking, etc. to make sure I have no broken links.

Is there a way I can put in automatic validation of my HTML directly from such Makefile?
That is, it needs to test my local non-published site. Preferably completely offline using a CLI tool…

Additionally, I would love to hear what checks and tests you do on your jekyll build scripts.

Is anyone else using Makefiles? If so, I would love to see examples of your Makefiles as I am not really good at making those myself.

Back in my Jekyll days I use to use HTML Proofer:

It doesn’t catch everything, but the stuff that matters :+1:

1 Like

Thanks for pitching in!

I have been using htmlproofer for quite a while to check for broken links. It does have some html validator, but I am not sure it actually works. At least it says my site have no issues but when running it through validator.w3.org it finds several issues…

1 Like

This is what I used to use fairly frequently:

The validator used by w3 is the Nu HTML Checker, available also from the command line:

Use a Rakefile instead, is much more easier because you can use Ruby instructions and you are free from tabs and other Makefile weirdness:

desc 'Runs the Nu HTML Checker'
task :vnu do
  vnu_path = "..."
  `java -jar "#{vnu_path}/vnu.jar" --skip-non-html _site/`
end