Customization
Most of the look is set from Ghost Admin without opening a file. This page is what is left: Yas’s colour, the fonts, and a small piece of injected code.
Code injection
Section titled “Code injection”Under Settings → Code injection:
- Site header is added on every page, inside
<head>. - Site footer is before the page closes. Use it for a script with
deferorasync. - A post’s own code injection, in the post settings, if you want code on one post only.
Header injection survives an update because Ghost stores it on the site, not in a theme file.
This example recolors buttons, links, and the progress bar. Put it in the site header:
<style> :root { --yas-accent: #8a4b2f; --yas-accent-strong: #6e3a24; --yas-accent-soft: #f3e6dc; --yas-on-accent: #fffaf6; } html[data-theme="dark"] { --yas-accent: #e2b08a; --yas-accent-strong: #f0c9ad; --yas-accent-soft: #3a2c24; --yas-on-accent: #2a160e; }</style>Keep the dark scheme in the same block. One colour on both backgrounds will fail contrast.
Yas colour and Ghost’s colour
Section titled “Yas colour and Ghost’s colour”Yas buttons, links, the progress bar, and cards read --yas-accent from src/css/10-tokens.css. The light value is #2f6f66.
Ghost’s brand accent colours Portal and Ghost comments, because those come from {{ghost_head}}, not from Yas’s stylesheet. Moving the two colours closer makes Portal and the theme feel related. Changing the brand accent alone does not repaint Yas’s buttons.
Under Design → Customize:
heading_typefacefor titles, menus, and buttons. Default: IBM Plex Sans Arabic.body_typefacefor post text. Default: Noto Naskh Arabic.
The four choices are IBM Plex Sans Arabic, Noto Kufi Arabic, Noto Naskh Arabic, and Amiri. All four are SIL Open Font License, shipped as woff2, split into Arabic and Latin with unicode-range. There is no request to Google.
Under Design → Brand → Typography, a Ghost font goes first. The Yas face remains the fallback for Arabic letters that font cannot draw. If the site does not match the demo, a brand font is usually set, and that is deliberate.
On ar, fa, and ur sites the Arabic body face is preloaded. Otherwise the Arabic file is not requested until it is needed.
To replace a family entirely, edit src/css/00-fonts.css and rebuild. Do not hand-edit assets/css/screen.css; npm run css overwrites it.
Image sizes
Section titled “Image sizes”package.json asks Ghost for widths of 160, 400, 720, 1200, and 2000 pixels. A post’s feature image is served up to 2000; cards are smaller. Upload a feature image at least 2000 pixels on the long side, and keep the subject near the centre, because the frame crops from the middle.
Building the theme
Section titled “Building the theme”npm installnpm run css # writes assets/css/screen.css from src/cssnpm run locales # checks translation keysnpm run zip # writes dist/yas.zipnpm test # the above, then gscan for Ghost 6Files: *.hbs templates at the root, partials/, locales/, assets/, and CSS sources in src/css. Properties are logical (margin-inline-start, inset-inline-end) so direction flips without a second stylesheet. Strings that JavaScript reads live in partials/strings.hbs, so the locale check sees them.
Changing the scheme fires yas:scheme. On Pro, after more posts are fetched, yas:cards fires so scripts can bind the new cards.
Ghost caps custom settings at twenty. The free theme uses 15. Pro uses all twenty. Do not add a Pro field without removing one.
Yas is free under the MIT licence. Yas Pro is a paid edition. By Yasser Maadan.