Ghost themes

Ghost主题

Ghost comes with a default theme called Casper, which is designed to be a clean, readable publication layout and can be easily adapted for most purposes.

Ghost附带了一个名为Casper的默认主题,它被设计为一种干净、可读的布局,可以很容易地适应大多数用途。

If you need something a little more customised, it's entirely possible to build on top of existing open source themes, or to build your own from scratch. Rather than giving you a few basic settings which act as a poor proxy for code, we just let you write code.

如果您需要一些更定制的东西,完全有可能在现有的开源主题上构建,或者从头开始构建您自己的主题。我们没有给您一些基本的设置,这些设置只能充当代码的糟糕代理,而是让您编写代码。

Marketplace

市场

There are a huge range of both free and premium pre-built themes which you can download from the Ghost Theme Marketplace:

在Ghost主题市场:有大量的免费和优质的预先建立的主题,你可以从里面下载:

Ghost theme marketplace screenshot
Anyone can write a completely custom Ghost theme with some solid knowledge of HTML and CSS

Theme development

主题开发

Ghost themes are written with a templating language called handlebars, which has a set of dynamic helpers to insert your data into template files. For example: {{author.name}} outputs the name of the current author.

Ghost主题是用一种名为handlebars的模板语言编写的,该语言有一组动态助手,可以将数据插入到模板文件中。例如:{{author.name}}输出当前作者的名称。

The best way to learn how to write your own Ghost theme is to have a look at the source code for Casper, which is heavily commented and should give you a sense of how everything fits together.

学习如何编写自己的Ghost主题的最佳方法是查看Casper的源代码,其中有大量的注释,应该能让您了解所有内容是如何结合在一起的。

  • default.hbs is the main template file, all contexts will load inside this file unless specifically told to use a different template.
  • post.hbs is the file used in the context of viewing a post.
  • index.hbs is the file used in the context of viewing the home page.
  • and so on
  • default.hbs是主模板文件,所有的上下文都会加载到这个文件中,除非被特别告知使用不同的模板。
  • post.hbs是在查看post的上下文中使用的文件。
  • index.hbs是在查看主页上下文中使用的文件。
  • 等等

We've got full and extensive theme documentation which outlines every template file, context and helper that you can use. You can also get started with our useful starter theme, which includes the most common foundations and components required to build your own theme.

我们有完整和广泛的主题文档,概述了您可以使用的每个模板文件,上下文和帮助。您还可以从我们有用的starter主题开始,它包括构建您自己的主题所需的最常见的基础设施和组件。

If you want to chat with other people making Ghost themes to get any advice or help, there's also a themes section on our public Ghost forum.
如果你想和其他制作Ghost主题的人聊天以获得建议或帮助,在我们的公共Ghost论坛上也有一个主题部分。