ghost
26
总安装量
26
周安装量
#7676
全站排名
安装命令
npx skills add https://github.com/mindrally/skills --skill ghost
Agent 安装分布
claude-code
21
opencode
19
gemini-cli
19
antigravity
16
cursor
15
Skill 文档
Ghost CMS Theme Development
You are an expert in Ghost CMS theme development, Handlebars templating, and modern frontend technologies.
Core Principles
- Write semantic, accessible HTML
- Use Handlebars helpers effectively
- Optimize for performance and SEO
- Follow Ghost theme development best practices
- Create responsive, mobile-first designs
Project Structure
theme/
âââ assets/
â âââ css/
â â âââ screen.css
â âââ js/
â â âââ main.js
â âââ images/
âââ partials/
â âââ header.hbs
â âââ footer.hbs
â âââ post-card.hbs
âââ default.hbs
âââ index.hbs
âââ post.hbs
âââ page.hbs
âââ tag.hbs
âââ author.hbs
âââ error.hbs
âââ package.json
Handlebars Templating
Basic Template Structure
<main class="site-content">
</main>
Default Layout (default.hbs)
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<link rel="stylesheet" href="">
</head>
<body class="">
<script src=""></script>
</body>
</html>
Partials
<article class="post-card ">
<a href="" class="post-card-image-link">
<img
class="post-card-image"
src=""
alt=""
loading="lazy"
>
</a>
<div class="post-card-content">
<h2 class="post-card-title">
<a href=""></a>
</h2>
<p class="post-card-excerpt"></p>
<footer class="post-card-meta">
<time datetime="">
</time>
<span class="reading-time"></span>
</footer>
</div>
</article>
Ghost Helpers
Content Helpers
Conditional Helpers
<span class="featured-badge">Featured</span>
<p>Welcome, !</p>
Loop Helpers
<div class="first-post">
</div>
Tailwind CSS Integration
Setup
// tailwind.config.js
module.exports = {
content: ['./**/*.hbs'],
theme: {
extend: {
colors: {
ghost: {
accent: 'var(--ghost-accent-color)',
},
},
},
},
};
Using Ghost Accent Color
:root {
--ghost-accent-color: {{@site.accent_color}};
}
.accent-bg {
background-color: var(--ghost-accent-color);
}
Alpine.js Integration
<div x-data="{ open: false }">
<button @click="open = !open">Toggle Menu</button>
<nav x-show="open" x-transition>
</nav>
</div>
Membership Integration
<p>Upgrade to access premium content</p>
<a href="#/portal/signup">Subscribe</a>
SEO and Performance
Meta Tags
<head>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Blog",
"name": "",
"url": ""
}
</script>
</head>
Image Optimization
<img
srcset="
300w,
600w,
1000w
"
sizes="(max-width: 600px) 300px, (max-width: 1000px) 600px, 1000px"
src=""
alt=""
loading="lazy"
>
Package.json Configuration
{
"name": "theme-name",
"version": "1.0.0",
"engines": {
"ghost": ">=5.0.0"
},
"config": {
"posts_per_page": 10,
"image_sizes": {
"s": { "width": 300 },
"m": { "width": 600 },
"l": { "width": 1000 },
"xl": { "width": 2000 }
}
}
}
Testing
- Use gscan to validate theme
- Test across different Ghost versions
- Check responsive behavior
- Validate membership features
- Test with various content types