1
Fork 0

Add hook for setting global variables

This commit is contained in:
Jake Howard 2023-09-13 21:23:43 +01:00
parent d2777ba027
commit 9eb09cf695
Signed by: jake
GPG Key ID: 57AFB45680EDD477
3 changed files with 9 additions and 0 deletions

6
hooks/globals.py Normal file
View File

@ -0,0 +1,6 @@
def on_env(env, config, files):
env.globals["globals"] = {
"foo": "bar"
}
return env

View File

@ -15,6 +15,7 @@ hooks:
- hooks/page-render.py
- hooks/static.py
- hooks/redirects.py
- hooks/globals.py
markdown_extensions:
- attr_list

View File

@ -14,3 +14,5 @@ Children: {{ page|children }}
Found page: {{ tag_1_page }}
Image resized: {{ "./assets/test.jpg"|resize_image(1500) }}
Globals: {{ globals.foo }}