Skip to content

Latest commit

 

History

History
199 lines (170 loc) · 8.91 KB

CONTRIBUTING.md

File metadata and controls

199 lines (170 loc) · 8.91 KB

Contributing to Pod

Thanks for wanting to help make Pod better. This document covers how to set up the theme locally, the conventions we follow, and how to submit a change.

Local development

Pod is a plain Ghost theme. Any Ghost 6.5.3+ install will do — local via ghost-cli, a container, or a scratch site.

From this directory:

npm install                 # install build dependencies
npm run dev                 # Vite in watch mode — rebuild assets on change
npm run build               # one-off production build
npm run validate            # gscan against Ghost 6.x
npm run lint                # formatting checks (same as CI)
npm run format              # let Prettier fix CSS/JS/JSON/YAML
npm run zip                 # package pod.zip for release

Point your local Ghost's theme directory at this repo (symlink into content/themes/pod, or bind-mount into your container). Activate the theme via Ghost admin → Settings → Design → Change theme.

Ghost re-reads .hbs files on every request, so template edits are live on the next browser refresh — no rebuild needed. Asset changes (assets/css/*, assets/js/*) require npm run dev or npm run build to regenerate assets/built/.

assets/built/ is committed, and your PR needs to include it. Ghost can install a theme straight from a GitHub repo, and that install path only sees tracked files — so the build output lives in Git, the same way Casper and Source do it. Run npm run build before committing any CSS or JS change and include the regenerated files; CI rebuilds and fails the PR if what you committed doesn't match its sources. Tailwind scans the .hbs files too, so a template change that introduces a new utility class is also a CSS change.

Where things live

pod/
├── assets/
│   ├── css/main.css        # Tailwind entry
│   ├── js/main.js          # Player + color-scheme + Pod meta hydration
│   ├── fonts/              # Self-hosted woff2 sources
│   └── built/              # Vite output (committed — see above)
├── locales/
│   └── en.json + de/fr/es/uk/it.json
├── partials/               # Reusable Handlebars partials
│   ├── audio-player.hbs    # Pod audio player shell
│   ├── cover-art.hbs       # Cover tile + gradient fallback
│   ├── header.hbs / footer.hbs / navigation.hbs
│   ├── subscribe-band.hbs  # Home / archive band
│   ├── subscribe-pills.hbs # Top-5 pills + more-link (shared by band & CTA)
│   └── subscribe-grid.hbs  # Full 10–16 platform grid on /subscribe/
├── podcast/
│   └── rss.hbs             # iTunes-spec podcast feed served at /podcast/rss/
├── subscribe.hbs           # /subscribe/ landing page
├── default.hbs             # Base layout
├── index.hbs               # Home + tag + archive collections
├── post.hbs                # Single episode / post
├── page.hbs / tag.hbs / author.hbs / error*.hbs
├── routes.yaml.example     # /podcast/rss/ + /subscribe/ routing snippet
└── package.json            # Theme metadata + build scripts + Ghost custom settings

Conventions

Formatting

.editorconfig holds the rules, and most editors apply it automatically. npm run lint checks them, and CI fails the PR when they're broken.

  • Spaces only, LF line endings, no trailing whitespace, newline at the end of every file.
  • .hbs templates (including podcast/rss.hbs) use 4-space indentation. Everything else uses 2 spaces.
  • Every line sits on that grid, so it's always a whole number of indent steps:
    • When a tag's attributes don't fit on one line, put each continuation line one step (4 spaces) deeper than the tag. Don't align them under the first attribute. A multi-line attribute value such as srcset goes one step deeper still.
    • Continuation lines of a multi-line comment ({{!-- --}} or /* */) sit one step deeper than the comment opener, not aligned after it.
    • Aligned columns inside a comment (e.g. a list of a partial's inputs) are fine, as long as each line still starts on the grid.
  • CSS, JS, JSON and YAML are formatted by Prettier (.prettierrc.json). Run npm run format instead of fixing them by hand. Templates aren't: Prettier can't parse Ghost's {{> partial}} syntax, so for .hbs only the editorconfig rules above are checked.

Handlebars

  • Prefer partials over inline logic when a block is repeated in more than one template.
  • Never reach into private Ghost helpers; stick to the documented set.
  • Keep the same escape-conscious style for {{content}} and {{html}}; the RSS template uses a strict <p>-only whitelist for a reason and shouldn't be widened without a specific ask.

CSS

  • Tailwind utility classes first; extract to main.css when you need a real component (.pill, .chip, .pod-player, …).
  • Colors flow from CSS custom properties on :root. Never hard-code brand colors — read from --color-* so the site accent, dark scheme, and inverse surfaces all cascade correctly.
  • The theme adapts to the publisher's Ghost admin choices (accent color, typography settings). Don't override those.

JavaScript

  • Vanilla JS only. No framework, no bundle bloat.
  • Prefer feature detection over user-agent sniffing.
  • Every interactive element must be reachable and operable via the keyboard.

Accessibility

  • All buttons / interactive elements need an aria-label when their visible text isn't self-describing.
  • Focus outlines are set globally via the .pod-shell :focus-visible rule. Don't disable them.
  • Preserve the .skip-link at the top of default.hbs.

Internationalization

  • Any user-facing string that isn't publisher content should go through the {{t "…"}} helper.
  • English is the canonical source. When you add a new string, also add it to every locale file with a translation you're confident in — or leave the translated value equal to the English string and flag it in your PR so a native speaker can complete it.

Podcast RSS

  • Every change to podcast/rss.hbs must be validated by Cast Feed Validator or equivalent before being merged.
  • The <content:encoded> whitelist is intentional. New Ghost card types need to be considered for whether they should degrade to prose in RSS.
  • qa/show-notes.mjs holds one test episode per show-notes shape (Lexical lists, markdown lists, nested lists, other cards). theme-qa seeds them into a real Ghost and qa/rss.spec.mjs checks what comes out of the feed. When you change the whitelist or find a post that breaks it, add a case there.

Submitting a change

  1. Fork the repository and create a topic branch off main.
  2. Do your work. Keep commits focused and well-described.
  3. Run the validators locally:
    npm run lint         # formatting
    npm run build
    npm run validate     # gscan
    npm run zip          # sanity-check the release artifact
    gscan should report ✓ Your theme is compatible with Ghost 6.x with zero warnings. If a warning surfaces, either fix it or explain in the PR why it's expected.
  4. Add a changeset for any user-visible change:
    npm run changeset
    Pick patch for a bug fix, minor for a new feature or setting, major for anything that breaks existing installations (a template rename, a removed custom setting, a Ghost-version bump). Write the summary as if you're describing the change to a publisher who's about to update — the text lands verbatim in CHANGELOG.md on release. Not every change needs one: docs edits, CI-only tweaks, and internal refactors that don't affect published output can go in without.
  5. Open a pull request. Include:
    • What the change does and why.
    • Any screenshots for visual changes (light and dark scheme both, if applicable).
    • Notes on backwards compatibility — Pod is used in production; breaking changes need a good story.

How releases happen

You don't hand-edit CHANGELOG.md or bump package.json — the release workflow does that for you. When your PR lands on main, the workflow opens a Version Packages PR that bumps the version and rewrites the changelog from the accumulated changesets. Merging that PR triggers the release job: it runs npm run zip, tags the commit as vX.Y.Z, and creates a GitHub Release with pod.zip attached — that's the file Ghost admins download for Settings → Design → Change theme → Upload.

Reporting a bug

Open an issue with:

  • Ghost version and Pod version.
  • Steps to reproduce.
  • Expected vs. actual behaviour.
  • If it's a visual bug, a screenshot in the affected color scheme.
  • If it's an RSS bug, the URL of the affected feed (or a paste of the relevant <item> block) and the app / validator that flagged it.

License

By contributing, you agree that your contributions will be licensed under the MIT License.