IMPORTANT: Since I'm no longer using Ghost as a frontend this repository is unmaintained.
A Ghost theme. Demo!
- Responsive layout
- Post search (Custom implemented)
- Translatable
- Sidebar (optionally affixed)
- Featherlight (Image lightbox, optional)
- Multiple post layouts (see post layout)
- Syntax highlighting
See Customization to enable/disable optional features.
- Unzip the theme directory to
<ghost directory>/content/themes/haven
- Done.
- Clone the repository to
<ghost directory>/content/themes/haven
- Run
npm i
to install dependencies - Build the theme by running
npm run build
- Done.
Important: Every change within the the
assets
directory requires you to rebuild the theme.
Keep in mind that customization is only available if you do have access to the source files, meaning that you need to clone the repository instead of just downloading the released theme.
Sadly Ghost doesn't support custom theme options; but it's still easy to en- or
disable features shipped with this theme. Open the assets/js/index.js
file and
see the initialization of the Theme
class and change to your needs:
(new Theme()).init({
logoSwitcher: true,
navbarBgAlpha: true,
affixSidebar: true,
featherlight: true
});
logoSwitcher
: swaps your publication logo to the navbar as soon as you've scrolled past it.navbarBgAlpha
: changes the alpha of the navbar background according to your scroll position. Alpha is set to1
as soon as you're at the end of the header.affixSidebar
: sticks your sidebar to the viewport when scrolling past it.featherlight
: turns images within your posts to responsive image lightboxes.
Styling-related things are implemented via SASS which makes it easy to change colors or other styles without having to write additional code.
Open assets/sass/_base.scss
and change everything to your needs.
There are two different post styles available for post previews; a compact one and a more feature image centric one.
Compact | Non compact |
---|---|
To switch between these layouts set the $compact-preview-layout
variable to true/false
in assets/_base.scss
.
Syntax highlighting is powered by Prism. By default it uses the Okaidia theme and supports the following languages: Javascript, CSS, Markup, C-like, Typescript, PHP, SASS/SCSS, Twig, YAML and Bash.
Extending the supported languages or changing the theme can easily be done by modifying the prismjs
in
the .babelrc
file.
In case you don't need the Syntax highlighting at all simply remove these lines from assets/js/index.js
:
import Prism from 'prismjs';
Prism.highlightAll();
- Clone the repository to
<ghost directory>/content/themes/haven
- Install npm dependencies with
npm i
- Run
npm run dev
to start webpack with the--watch
flag - SASS and JS will be automatically compiled after changes
The theme is tested against
- gscan (
npm run gscan
) - sass-lint (
npm run sass-lint
) - eslint (
npm run eslint
)
Alternatively you can run npm test
to test all of the above.
To build the theme simply run npm run build
. This will run webpack
in production, which will
automatically take care of asset optimization (aka minification and uglification).
- How does the post search work?
It's a client-side custom implementation based on lunr.js (see here).
- Where to report issues / request features?
Use the GitHub issue tracker.
- I've done a thing, do you accept Pull requests?
Sure. Just make sure tests are succeeding.
- How to add comments?
The post.hbs
template provides a comment placeholder section
which is commented out
by default (section id is comments
). Use this placeholder
and paste your comment code there.
Created by nehalist.io - Released under the MIT license.