惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Palo Alto Networks Blog
P
Proofpoint News Feed
云风的 BLOG
云风的 BLOG
Vercel News
Vercel News
阮一峰的网络日志
阮一峰的网络日志
量子位
Blog — PlanetScale
Blog — PlanetScale
有赞技术团队
有赞技术团队
腾讯CDC
博客园 - Franky
The Cloudflare Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Hugging Face - Blog
Hugging Face - Blog
H
Heimdal Security Blog
L
LangChain Blog
V
V2EX
Jina AI
Jina AI
美团技术团队
V2EX - 技术
V2EX - 技术
V
Visual Studio Blog
Google Online Security Blog
Google Online Security Blog
人人都是产品经理
人人都是产品经理
Security Archives - TechRepublic
Security Archives - TechRepublic
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Know Your Adversary
Know Your Adversary
Hacker News: Ask HN
Hacker News: Ask HN
Apple Machine Learning Research
Apple Machine Learning Research
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
T
Threat Research - Cisco Blogs
Y
Y Combinator Blog
博客园_首页
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Spread Privacy
Spread Privacy
C
Cisco Blogs
博客园 - 三生石上(FineUI控件)
Microsoft Azure Blog
Microsoft Azure Blog
B
Blog
PCI Perspectives
PCI Perspectives
MongoDB | Blog
MongoDB | Blog
A
About on SuperTechFans
B
Blog RSS Feed
N
News and Events Feed by Topic
L
LINUX DO - 热门话题
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Threatpost
月光博客
月光博客
Recent Announcements
Recent Announcements
D
DataBreaches.Net
IT之家
IT之家
C
Cyber Attacks, Cyber Crime and Cyber Security

Example blog

Ghost routing explained with routes.yaml examples — routes, collections & taxonomies Ghost redirects explained with practical redirects.yaml examples How to Serve JSON or XML Data in Ghost How to Change Your Default Post Template in Ghost Ghost Custom Theme Settings How to add Google Fonts to Ghost Themes How to Configure Ghost with Mailgun How to Make Custom Templates in Ghost Themes How to Install Ghost CMS via Ghost-CLI How to Add Syntax Highlighting to Ghost The best Ghost CMS hosting platforms Ghost 6.0 — Social Web and Native Ghost Analytics Ghost CMS Social web beta, email 2FA and more author social links How to keep custom design settings when updating your Ghost theme How to use the public preview card in Ghost How to add members-specific sections in Ghost How to customize the default content CTA in Ghost How to build a custom homepage in Ghost An overview of Ghost editor cards and and how they work Ghost CMS News: One-time payments & collecting sales tax How to customize the private site access template in Ghost How to add custom fonts in Ghost themes Ghost CMS News: Additional payment methods & internal linking How to use Code Injection in Ghost How to set meta data of your custom routes & collections in Ghost Ghost CMS News: TK reminders, ActivityPub and improvements How to format dates and use the date helper in Ghost Ghost CMS internationalization, custom fonts & spam protection Understanding and optimizing post and page settings in Ghost CMS Trigger the Ghost Portal popup based on page scroll progress How to Deploy Your Ghost Theme with GitHub Actions How to create a custom recommendations page for your Ghost CMS theme Ghost CMS News: New editor, refreshed settings & recommendations Ghost CMS News: Source - the new default theme and native image editing How to Add Different Logos for Dark & Light Themes in Ghost Upgrade to Node v18 for Ghost CMS & common errors Ghost Snippets: Adding Schema markup in Ghost How to add a scroll-based progress bar to your Ghost CMS site How to Create a Custom Navigation Template in Ghost How to Segment Subscribers with Member Labels in Ghost The best way to create a contact page in Ghost How to Use the Ghost Subscription Forms in Your Theme & Posts How to update your Ghost site URL when self-hosting Ghost CMS News: Signup cards and better landing pages How to Add Breadcrumbs to Your Ghost Theme How to integrate the Applause Button into your Ghost theme How to Hide a Post From the Home Page in Ghost CMS Ghost CMS block and contentFor helper overview & tips How to add Image Lightbox to Ghost Themes Ghost CMS News: Signup form embed, new editor and bulk actions. Biron Themes becomes Bright Themes 🎉 How to Audit & Test a Ghost Theme How to Create Related Posts Section in Ghost How to Use Ghost Filter Expressions Ghost CMS newsletter settings and post analytics How to Update Your Ghost Theme When We Release New Versions Ghost CMS News: Automatic list cleaning & email troubleshooting How to Create a Featured Post Slider in Ghost How to Add Reading Time to Ghost Blog Posts How to Create a Post Archive for Your Ghost Theme Ghost CMS Price Helper Overview & Tips Self-Hosted Ghost CMS with DigitalOcean Ghost CMS News: Member Growth Sources & Audience Feedback How to Open External Links in a New Tab in Ghost How to Integrate Google Analytics with Ghost Ghost CMS News: History Log & Newsletter Analytics How to Automatically Add Member Labels From Referral Traffic in Ghost? Ghost CMS News: Free trials & email notifications Ghost CMS Match Helper Usage & Tips Ghost CMS News: Native Comments Ghost CMS News: Ghost Explore & Premium Newsletter Previews Ghost Snippets: Custom Progress Cards & Steps Ghost CMS News: Native Search The Best Ghost CMS Search Plugins & Libraries Ghost Snippets: Custom Stylish Tables How to Add a Scroll Top & Progress Indicator Button in Ghost Ghost Snippets: Accordions How to Add Tag Dropdown to Your Ghost Theme Ghost 5.0 released 🎉 Ghost Snippets: Custom Subscribe Forms Ghost Snippets: Custom Alert Boxes How to Show Post or Newsletter Issue Number in Ghost How to Self-Host Google Fonts in Ghost CMS Ghost CMS News: Membership, Tiers & Activity Feed Custom Pages in Ghost CMS Themes Ghost CMS Search Using Fuse.js Ghost CMS News: Offers and Discounts & New Cards Ghost CMS News: Membership tiers, email CTA & filters Ghost CMS News: Grammarly Support & Feature Image Captions. Ghost CMS News: Improved Member Accounts & Personalized Newsletter. Ghost 4.0 Launched With Native Newsletters & Membership Ghost CMS News: Cancellation Feedback & Newsletter Stats. Ghost CMS News: Improved Member Dashboard & Sidebar Views. Ghost CMS News: Google Pay support, email newsletters & secondary navigation Ghost CMS News: Member Support, Portal & Content Snippets. Ghost CMS News: Referral Programs & Responsive Images. Ghost Themes as Progressive Web Apps Ghost 3.0 is here with brand new features Ghost 2.0 is here with new features How to Add Search to Ghost Using ghostHunter
Ghost Theme Structure & Organization
Bright Themes · 2026-03-27 · via Example blog

In this tutorial we'll explore the basics of a Ghost theme, focusing on file structure and organization.

Ghost themes use the Handlebars templating language, which generates server-rendered HTML and delivers it to the browser. Ghost uses express-hbs under the hood to power theme helpers and additional Handlebars features.

Basic Ghost Theme Structure

This is the most basic structure for any Ghost Theme:

├── /assets
 |      ├── /css
 |      ├── /fonts
 |      ├── /js
├── /partials
├── default.hbs
├── index.hbs [required]
├── post.hbs [required]
├── page.hbs [optional]
└── package.json [required]

All assets such as styles (css), fonts and js should be added in the /assets directory. Actually there is a {{asset}} helper provided by Ghost to help with asset management.

Using the asset helper:

// General usage:
{{asset 'asset-path'}}

// Example usage for site logo
{{asset 'images/site-logo.jpg'}}

(Learn more about the asset helper.)

The /partials folder is great for parts of templates that will be used multiple times without duplicating the code and making maintenance easier.

Using the partials folder:

{{> "partial-name"}}

An example where partial templates come in handy is for post cards, looping over a list of posts and generating a specific layout for these:

{{#foreach posts}}
  {{> "post-card"}}
{{/foreach}}

Next, let's take a look at the templates.

Basic Ghost Templates

The most important ones are index.hbs and post.hbs as these ones are required for any ghost theme to be valid. Common templates used in Ghost Themes:

  • default.hbs - it's the base template that contains the most basic parts of HTML that should be on every page (<html>, <head> or <body>).
  • index.hbs - a required template that usually renders the index page of the site
  • home.hbs - an optional template to render the home page of the site (if not provided index.hbs is used instead)
  • post.hbs - a required template for rendering a single post ( {{#post}} helper is used access and output post details).
  • page.hbs - an optional template for static pages ( If it's not present then post.hbs will be used). Check out this tutorial on how create custom pages for your ghost theme
  • custom-{{template-name}}.hbs - an optional custom template that can be selected in the admin for posts and pages.
  • tag.hbs - an optional template for tag page.
  • author.hbs - an optional template for author page.
  • error.hbs - an optional theme template for errors (ex. accessing a not existing page)

There is also a package.json file.

This is a required file that provides basic information about the theme, plus configuration values that Ghost reads (like how many posts to show per page and what responsive image sizes to generate).

Example package.json file:

{
  "name": "your-theme-name",
  "description": "Add some description fo the theme",
  "version": "1.0.0",
  "engines": {
    "ghost-api": "v5"
  },
  "config": {
    "posts_per_page": 10,
    "image_sizes": {
      "xs": {
        "width": 100
      },
      "s": {
        "width": 300
      },
      "m": {
        "width": 600
      },
      "l": {
        "width": 1000
      }
    }
  }
}

Note

The exact ghost-api value depends on what your theme supports. Use the latest version your theme is compatible with, and validate using GScan.

Membership templates

Starting with Ghost 3.0 you can turn your site into a membership and subscription based publication. For this your theme requires additional files to be included:

├── /members
 |      ├── account.hbs
 |      ├── signin.hbs
 |      ├── signup.hbs

A new directory called members should be created with the above 3 files. account.hbs - is the template to render a logged in user account page signin.hbs - is the template to rendering the sign in page signup.hbs - this template will render the sign up page

After the templates are created you have to tell Ghost where these files can be found, and you can do that using routes.yaml. Read more about routing.

An example of routes.yaml file:

routes:
  /signup/: members/signup
  /signin/: members/signin
  /account/: members/account

collections:
  /:
    permalink: /{slug}/
    template: index

taxonomies:
  tag: /tag/{slug}/
  author: /author/{slug}/

That's it for an overview about the structure of Ghost Themes. You can dive deeper in the topic in the official Ghost Docs.