|
| 1 | +# Source |
| 2 | + |
| 3 | +The default theme for [Ghost](http://github.com/tryghost/ghost/). This is the latest development version of Source! If you're just looking to download the latest release, head over to the [releases](https://github.com/TryGhost/Source/releases) page. |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | +# First time using a Ghost theme? |
| 8 | + |
| 9 | +Ghost uses a simple templating language called [Handlebars](http://handlebarsjs.com/) for its themes. |
| 10 | + |
| 11 | +This theme has lots of code comments to help explain what's going on just by reading the code. Once you feel comfortable with how everything works, we also have full [theme API documentation](https://ghost.org/docs/themes/) which explains every possible Handlebars helper and template. |
| 12 | + |
| 13 | +**The main files are:** |
| 14 | + |
| 15 | +- `default.hbs` - The parent template file, which includes your global header/footer |
| 16 | +- `home.hbs` - The homepage |
| 17 | +- `index.hbs` - The main template to generate a list of posts |
| 18 | +- `post.hbs` - The template used to render individual posts |
| 19 | +- `page.hbs` - Used for individual pages |
| 20 | +- `tag.hbs` - Used for tag archives, eg. "all posts tagged with `news`" |
| 21 | +- `author.hbs` - Used for author archives, eg. "all posts written by Jamie" |
| 22 | + |
| 23 | +One neat trick is that you can also create custom one-off templates by adding the slug of a page to a template file. For example: |
| 24 | + |
| 25 | +- `page-about.hbs` - Custom template for an `/about/` page |
| 26 | +- `tag-news.hbs` - Custom template for `/tag/news/` archive |
| 27 | +- `author-ali.hbs` - Custom template for `/author/ali/` archive |
| 28 | + |
| 29 | + |
| 30 | +# Development |
| 31 | + |
| 32 | +Source styles are compiled using Gulp/PostCSS to polyfill future CSS spec. You'll need [Node](https://nodejs.org/), [Yarn](https://yarnpkg.com/) and [Gulp](https://gulpjs.com) installed globally. After that, from the theme's root directory: |
| 33 | + |
| 34 | +```bash |
| 35 | +# install dependencies |
| 36 | +yarn install |
| 37 | + |
| 38 | +# run development server |
| 39 | +yarn dev |
| 40 | +``` |
| 41 | + |
| 42 | +Now you can edit `/assets/css/` files, which will be compiled to `/assets/built/` automatically. |
| 43 | + |
| 44 | +The `zip` Gulp task packages the theme files into `dist/<theme-name>.zip`, which you can then upload to your site. |
| 45 | + |
| 46 | +```bash |
| 47 | +# create .zip file |
| 48 | +yarn zip |
| 49 | +``` |
| 50 | + |
| 51 | +# PostCSS Features Used |
| 52 | + |
| 53 | +- Autoprefixer - Don't worry about writing browser prefixes of any kind, it's all done automatically with support for the latest 2 major versions of every browser. |
| 54 | + |
| 55 | + |
| 56 | +# SVG Icons |
| 57 | + |
| 58 | +Source uses inline SVG icons, included via Handlebars partials. You can find all icons inside `/partials/icons`. To use an icon just include the name of the relevant file, eg. To include the SVG icon in `/partials/icons/rss.hbs` - use `{{> "icons/rss"}}`. |
| 59 | + |
| 60 | +You can add your own SVG icons in the same manner. |
| 61 | + |
| 62 | + |
| 63 | +# Copyright & License |
| 64 | + |
| 65 | +Copyright (c) 2013-2023 Ghost Foundation - Released under the [MIT license](LICENSE). |
0 commit comments