Freestruct Docs

Custom Injection

Freestruct supports custom injection hooks - create template files in docs/_freestruct/ and they’ll be auto-loaded if they exist.

Note: Location is _freestruct/ (not _includes/) to avoid collisions with Jekyll and other SSGs.

Hooks

File Injected
inject-header.html Before </head>
inject-body-start.html After <body>
inject-footer.html Before </body>

Placeholders

All hooks support these placeholders:

Examples

Add custom fonts (inject-header.html)

<link rel="stylesheet" href="/fonts/inter.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<a href="#main" class="skip-link">Skip to content</a>

Add analytics (inject-footer.html)

<script defer src="/js/analytics.js"></script>

How it works

  1. Create or edit the template file in docs/_freestruct/
  2. Run your SSG build
  3. Run node docs/lib/inject.js [output]
  4. Check the output HTML

The files are loaded only if they exist - no config needed.

See also