Advanced

Code injections

What Ghost code injection is, when to use it with Miyus instead of theme settings, and recipes for custom fonts and corner roundness.

Code injection is Ghost's built-in way to add small snippets of code to your site without touching theme files. Anything you put there survives theme updates, which makes it the right place for tweaks that go beyond the theme's settings.

Where it lives

In Ghost Admin, go to Settings → Code injection. You'll find two boxes:

  • Site header — code added to the top of every page. This is where styling snippets (<style> blocks) and font embed codes go.
  • Site footer — code added to the bottom of every page. Mostly used for analytics or other scripts; the recipes in this section don't need it.

Paste your snippet, click Save, and refresh your site to see the change.

When to use it

Reach for theme settings first — dark mode, colors, the hero, homepage sections, and related posts are all covered under Theme settings, no code needed. Use code injection when you want something the settings don't offer, like a specific Google Font or sharper corners.

What's safe to target in Miyus

Miyus exposes a small set of CSS variables designed for exactly this — --body-font, --title-font, and --global-border-radius. Overriding them is safe and update-proof. Targeting the theme's internal class names is not recommended: they can change between releases, which would silently break your snippet.

Recipes