diff --git a/hooks/globals.py b/hooks/globals.py new file mode 100644 index 0000000..fc5a77a --- /dev/null +++ b/hooks/globals.py @@ -0,0 +1,6 @@ +def on_env(env, config, files): + env.globals["globals"] = { + "foo": "bar" + } + + return env diff --git a/mkdocs.yml b/mkdocs.yml index 991ca58..778c371 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -15,6 +15,7 @@ hooks: - hooks/page-render.py - hooks/static.py - hooks/redirects.py + - hooks/globals.py markdown_extensions: - attr_list diff --git a/theme/main.html b/theme/main.html index 54eb461..ceaef1c 100644 --- a/theme/main.html +++ b/theme/main.html @@ -14,3 +14,5 @@ Children: {{ page|children }} Found page: {{ tag_1_page }} Image resized: {{ "./assets/test.jpg"|resize_image(1500) }} + +Globals: {{ globals.foo }}