Static Site Generator

How-to: How to implement a custom plugin?

How to implement a custom plugin?

We add a plugin to display the last build date in the footer.

Step 1

Create a new script in the plugins directory:


Step 2

Add a method that returns today's date:

from datetime import datetime

def now(data: dict, args: dict) -> str:
    if 'format' not in args:
        args['format'] = '%B %d, %Y at %H:%M'

Step 3

Call the plugin method in any template file:

    Last refresh: {: :}

Update the default date format with an option:

    Last refresh: {: format:"%m/%d/%Y %H:%M" :}