getnikola / nikola

A static website and blog generator
https://getnikola.com/
MIT License
2.6k stars 444 forks source link

Generic pre-deploy checks #3695

Closed JesperDramsch closed 1 year ago

JesperDramsch commented 1 year ago

Requested Feature: A generic hook into the deploy action to check a list of user-supplied criteria.

Related Area: Tasks? Could be an extra task to run.

Do you want to contribute this yourself as a pull request? (don’t worry about it if you don’t want to/can’t — someone else can take care of it)

Does this feature affect backwards compatibility? If yes, in what way? No

Rationale and full description: (why should it be added to Nikola?) Just like nikola check it would be fantastic to have a way to generically hook into the deploy action and check if a blog post meets user-defined criteria.

Basically, I always forget to add the <!-- TEASER --> thingy. And I would like the deploy to fail if my blog posts don't meet certain criteria, like containing that string.

But I think having a list of criteria would just be really useful.

Kwpolska commented 1 year ago

Without requiring any changes being made to Nikola itself, you can leverage the fact that nikola deploy aborts if any command returns a non-zero exit code. You can write a simple Bash/Python script that scans your files in any way you want.