Snippets
A snippet is a raw code fragment, HTML, JavaScript, CSS, that Chinaski injects into your built pages’ head or body. It’s the right tool for analytics trackers, verification tags, custom styles, and small scripts. (For visible, embeddable content, use blocks instead.)
Head or body
Every snippet has a position: head snippets are injected before the closing </head> of each built page; body snippets go before </body>. The injection looks for the last matching tag in each document, so unusual templates can’t misplace the code.
Global snippets
Snippets can be global: those are injected automatically into every page, post, and blog listing that gets built; they don’t need per-item assignment. Non-global snippets are attached to specific pages or posts from that page’s or post’s editor (they show up there as assignable entries; global ones intentionally don’t appear in those lists).
A snippet can either target one language, or be left language-free to inject everywhere. On any given page both kinds combine: the targeted ones plus the language-free ones, deduplicated so a snippet can’t be added twice to the same page by both routes.
Order and repetition
Head snippets always come before body snippets. Within each group, global snippets are injected before page- or post-assigned ones. The same code is never injected twice on the same page even if a snippet is both global and assigned.
Language scoping
Each snippet can be limited to one language. When you leave the language empty, it applies across every language. Non-global snippets assigned to a page or post ride along with that item’s language.
Air-gapped instances
In air-gap mode snippets containing external references (scripts, stylesheets, iframes, or images pointing outside the server) are stripped at injection, keeping the built site fully offline-operable.
Privacy-sensitive snippets
There’s a flag marking a snippet as containing tracking or analytics code. Flagged snippets:
- get a “Sensitive” badge in the snippet list, so reviewers can spot them;
- are always recorded in the revision history, so changes to them leave an audit trail.
Editing and revisions
The Snippets screen lists every snippet with Global / Per-page and Sensitive badges. Each snippet keeps revisions: restoring an earlier revision restores the code as it was then. Permanently deleting a snippet requires an explicit confirmation, and a delete-with-restore flow exists alongside it.
Import and export
Snippets support JSON and CSV export and import, individually or in bulk; the same import/export machinery as blocks, so you can move them between instances without retyping.