Summary
Add a CLI flag to skip internet access on zola check
.
For example, if you run zola check --offline
then it checks the site except for the external links availability.
Description
In some situations, users may want frequent checks but infrequent external links check.
- If a site contains so many external links or links to heavy servers, the check may take long time.
- If a user
zola check
frequently (e.g., hooking filesystem access or CI for every commits), they would want zola to skip external links check for such frequent runs, but eventually they will run external links check before publishing the site.
zola check --offline
(or something like --ignore-external-links
?) will be useful to support such use cases, and users can run checks more frequently without risks and costs.
Alternatives
Config file
skip_prefixes = ['http://', 'https://']
in [link_checker]
section of config.toml may let zola check
ignore the external links, but this requires file modification. This is not simple as --offline
flag, and automated edit could be difficult if the field already have some values.
Flag name
I prefer --offline
as it is simple and clear, but people might prefer more verbose names?
PoC
Implemented a patch https://github.com/lo48576/zola/tree/feature/offline-check-flag and seems to work as I expected.
Diff is reasonably small.