Includes
Neko supports injecting custom HTML content into your generated pages using the _includes directory.
Head Includes
You can inject custom HTML into the <head> section of every generated page by creating a file named head.html inside an _includes directory in your project root.
This is useful for adding:
- Custom CSS styles
- JavaScript libraries (e.g., analytics scripts)
- Custom meta tags
- Fonts
Usage
- Create a directory named
_includesin your project root (where yourneko.ymlis located). - Create a file named
head.htmlinside_includes. - Add your HTML content to
head.html.
Example
Structure:
my-project/
├── _includes/
│ └── head.html
├── index.md
└── neko.yml
_includes/head.html:
<!-- Add a custom font -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet">
<!-- Add a custom script -->
<script>
console.log("Hello from the head include!");
</script>
<!-- Add custom styles -->
<style>
body {
font-family: 'Roboto', sans-serif;
}
</style>
Neko will automatically detect this file and insert its contents into the <head> section of every page, just before the closing </head> tag.