here! I am looking for a tool that would allow us to check Markdown files modified/added by a PR for things such as accessibility (presence of alt text for images &co), in the GitHub repo of our Hugo website that is deployed via Netlify.
E.g. I’ve seen the Accesslint GitHub app for other languages.
Does such a tool already exist for Hugo websites? Or could someone share a setup serving the same goals? I’d actually like to avoid using CI+Netlify instead of just Netlify hence my preference for a GitHub app.
I know that checking only the files touched by the PR adds difficulty but it’s quite important to us since we know that old posts of our website might not respect best practice.
I don’t know of anything like this. If it existed, it would probably have to be somewhat custom-made for Hugo since it would have to understand which source files correspond to which outputs, plus any custom shortcodes you might use. Also, true accessibility checks should probably check the result HTML files anyway since the template might also influence how accessible the site is (things based on front-matter etc).
However, maybe you’re willing to forgo the requirement of checking only files modified/added by a PR and avoiding a CI, because netlify itself should be able to run any command (so it works as a CI).
You could use either AccessLint or html proofer to check the output (HTML) of your whole site at once. If your website has initially no accessibility errors, and a new PR is made, netlify could run the html proofer before finishing the build and fail it if the tool finds any errors. The failed build status could be sent via github commit check webhook to the respective Github PR.
Since the site had 0 warnings / errors before the PR, you know that all the errors were caused by the PR.
This is what would usually do in software projects. Run tests for the whole application for each PR and make sure the main branch is green (no failed tests).
I haven’t tried to do this myself with Netlify so I’m not sure how easy it is to integrate the validation to the workflow, but it doesn’t seem impossible to me.
1 Like
Thanks for the tips!
I am aware of that, maybe I should spend some time adding e.g. alt text to all old posts instead of finding a complicated workaround. 