summaryrefslogtreecommitdiff
path: root/wiki
diff options
context:
space:
mode:
authorFrancesco Tomaselli <tomaselli.fr@gmail.com>2025-04-02 12:19:08 +0200
committerGitHub <noreply@github.com>2025-04-02 12:19:08 +0200
commitb8f85832c51ba1ab21700e7b7a674f563b7a2657 (patch)
tree5321c0152756c3a13213b03a28cb08427455992c /wiki
parent9794243a3ff85aae024d6a8f7439702cc66f3f73 (diff)
parentc9e49557f43a31b6072035e25f0bbfcd408a1a87 (diff)
Merge pull request #112 from crnh/crnh/feature/hooks
Diffstat (limited to 'wiki')
-rw-r--r--wiki/features/hooks.md29
1 files changed, 29 insertions, 0 deletions
diff --git a/wiki/features/hooks.md b/wiki/features/hooks.md
new file mode 100644
index 0000000..31bbb21
--- /dev/null
+++ b/wiki/features/hooks.md
@@ -0,0 +1,29 @@
+---
+title: "Hooks"
+date: "2024-10-6"
+summary: "Layout hooks"
+description: "Layout hooks"
+toc: false
+readTime: false
+autonumber: true
+math: false
+showTags: false
+---
+
+Hooks allow to customize layouts by injecting custom code at specific points in the layout.
+Hooks are defined in the `layouts/partials/hooks` directory.
+The following hooks are currently available:
+
+- `head_start` is inserted at the beginning of the `<head>` tag.
+- `head_end` is inserted at the end of the `<head>` tag.
+- `body_end` is inserted at the end of the `<body>` tag.
+- `footer_start` is inserted at the beginning of the footer.
+
+To create a hook, add a file named `<hook_name>.html` in the `layouts/partials/hooks` directory. The file should contain the code you want to inject at that point in the layout.
+For example, to preload a font, you can create a file named `head_start.html` in the `layouts/partials/hooks` directory with the following content:
+
+```html
+<link rel="preload" href="/fonts/Literata/Literata-Light.woff2" type="font/woff2" as="font" crossorigin>
+```
+
+The full context is passed to the hook, so any variables available in the page context can be used in the hook. \ No newline at end of file