Sapphire

Ghost theme

About

Sapphire is a Ghost theme most suitable for building niche publications and personal websites. You can use this theme to show your work, run a blog, build premium memberships for your audience and share what you do.

Supports Ghost version 4.x

Demo: sapphire.stylesheets.dev

Theme Installation

The first step is to unzip the downloaded package. Inside the new directory sapphire, you'll find the zipped theme and a documentation file.

Follow these steps to upload the theme to Ghost:

  1. Login to your ghost admin dashboard (example.com/ghost).

  2. Click the settings icon at the bottom of the left-hand side.

  3. Go to Themes and click Upload a theme.

  4. Select the theme file.

  5. Once uploaded, click on Activate now button to activate the theme immediately or Close if you want to activate it later.

Theme Development

The theme uses Gulp and Node.js for development purposes. You'll need Node.js v12.x.x or v14.x.x installed on your machine. (If you're on a different version of Node, we recommend using NVM to manage multiple versions of Nodejs and set the correct one for developing this theme).

Once you have Node.js and Ghost setup ready on your machine, run the following commands from the theme root directory:

# To install node modules
npm install
# To compile and watch for changes in SCSS and JS files
npm run dev

Now you can edit the SCSS and JS files in /assets/sass/ & /assets/js/ directories. These will get compiled to /assets/built/ automatically.

To generate a production-ready theme zip file, run the following command. It will minify all the CSS & JS files and package the theme into dist/<theme-name>-<version>.zip .

# To generate production ready theme zip file.
# check the /dist folder after completion.
npm run build

LiveReload

LiveReload chrome plugin watches over the handlebars, CSS, SCSS, and JS files and automatically reloads the browser while developing the theme.

The configuration for LiveReload has already been done in the theme Gulpfile. You can install this chrome plugin and activate it to make your development easier.

Change Color Scheme & Fonts

All the colors and fonts are managed through CSS variables. You can change colors and fonts by editing the /assets/sass/base/_variables.scss file.

This file contains variables for primary color, text colors, background color, and primary & secondary fonts.

:root {
/* Colours */
--color-primary: #222222;
--color-primary-lighter: color-mod(var(--color-primary) tint(35%));
--color-text: color-mod(var(--color-text-bold) l(30%));
--color-text-secondary: #757575;
--color-text-bold: #222;
--color-bg: #ffffff;
--color-bg-secondary: color-mod(var(--color-bg) shade(4%));
--color-border: #e7e7e7;
--color-border-lighter: #f1f1f1;
/* Fonts */
--font-primary: 'Work Sans', -apple-system, blinkmacsystemfont, 'Segoe UI',
'Roboto', 'Oxygen', 'Ubuntu', 'Helvetica Neue', sans-serif;
--font-secondary: 'Merriweather', georgia, times, serif;
--font-normal: 400;
--font-bold: 700;
}

After making the required changes, you'll have to re-compile the theme. This can be done by running the npm run build command. This will generate the zip file. Follow the Theme Development guide for more details on compiling the theme.

Make Dark Mode as Default

Sapphire theme comes with three color modes – "Light", "Dark", "Warm", which users can change by clicking the color modes icon on the bottom left-hand side.

Light mode is the default for the theme, but you can change the defaults by making the following changes:

  1. Edit default.hbs and add class color-scheme--dark or color-scheme--warm to the HTML tag as shown below.

    <html lang="{{@site.locale}}" class="color-scheme--dark">
  2. Edit assets/js/main.js and change the colorSchemes array to set the sequence of color schemes that users will see.

    /* Dark Mode */
    const colorSchemes = ['dark', 'light', 'warm']

Recompile the theme.

Comments

The theme supports comments from services like Disqus, Commento, etc.

Look for the following space in the post.hbs file:

{{!--
<div class="post-widget post-comments-widget post-widget--no-margin">
If you want to embed comments, this is a good place to do it!
</div>
--}}

Disqus

Create a Disqus account and retrieve embed code for your site. Paste the embed code inside the space left for it as shown below.

<div class="post-widget post-comments-widget post-widget--no-margin">
<!-- Disqus Embed Code -->
<div id="disqus_thread"></div>
<script>
/**
* RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
* LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables */
var disqus_config = function () {
// this.page.url = PAGE_URL; // Replace PAGE_URL with your page's canonical URL variable
this.page.identifier = "ghost-{{comment_id}}"; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
};
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = 'https://sapphire-2.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</div>

Add Social Media Icons

Twitter, Facebook, and RSS feed icon are already implemented in the theme. To add more icons follow these steps:

  1. Download SVG of the icon from Simple Icons.

  2. In partials/icons/ paste SVG file and change its extension to .hbs (instead of .svg)

    For example, you created a file called partials/icons/pinterest.hbs , It should look like this:

    <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path d="M12.017 0C5.396 0 .029 5.367.029 11.987c0 5.079 3.158 9.417 7.618 11.162-.105-.949-.199-2.403.041-3.439.219-.937 1.406-5.957 1.406-5.957s-.359-.72-.359-1.781c0-1.663.967-2.911 2.168-2.911 1.024 0 1.518.769 1.518 1.688 0 1.029-.653 2.567-.992 3.992-.285 1.193.6 2.165 1.775 2.165 2.128 0 3.768-2.245 3.768-5.487 0-2.861-2.063-4.869-5.008-4.869-3.41 0-5.409 2.562-5.409 5.199 0 1.033.394 2.143.889 2.741.099.12.112.225.085.345-.09.375-.293 1.199-.334 1.363-.053.225-.172.271-.401.165-1.495-.69-2.433-2.878-2.433-4.646 0-3.776 2.748-7.252 7.92-7.252 4.158 0 7.392 2.967 7.392 6.923 0 4.135-2.607 7.462-6.233 7.462-1.214 0-2.354-.629-2.758-1.379l-.749 2.848c-.269 1.045-1.004 2.352-1.498 3.146 1.123.345 2.306.535 3.55.535 6.607 0 11.985-5.365 11.985-11.987C23.97 5.39 18.592.026 11.985.026L12.017 0z"/></svg>
  3. Next, edit partials/social-media-icons.hbs and add the icon

    <ul class="social-media-icons">
    ...other icons
    <li>
    <a href="https://pinterest.com/" title="Pinterest" target="_blank" rel="noopener">{{> "icons/pinterest"}}</a>
    </li>
    </ul>

Language Translations

The theme is translation ready and includes translation files for English (en) and German (de). To add a translation for any other language, create the translation file in locales/ directory.

To add a new language, follow these steps:

  1. Create a new file in the theme’s locales folder with the language ISO Code code. So, if the new language is Spanish, the new file name will be es.json.

  2. Copy the en.json file content into your new file and start to translate each line. The key is plain English that exists in all translation files and should not be changed. You should change only the value.

To set the language in Ghost, Go to Admin > General > PUBLICATION INFO > Publication Language and enter the language code (es in this example).

Add Custom Bio Section in Sidebar

To add the custom author bio section in the header, edit partials/header.hbs and un-comment the following line

Custom bio section in header
{{!-- {{> "header-bio"}} --}}

Next, edit partials/header-bio.hbs and change the slug author's slug.

{{!-- Change the slug below!! --}}
{{#get "authors" filter="slug:jane" }}
{{#foreach authors}}
<div class="header-bio">
<img src="{{profile_image}}" alt="{{name}}" />
<p>
{{!-- Add bio here --}}
This section is optional. You can use this to introduce yourself as the author of this blog.
{{!-- Un-comment the below line if you want to show author's bio from Ghost here --}}
{{!-- {{bio}} --}}
</p>
</div>
{{/foreach}}
{{/get}}

Adding Buttons in Post Content

You can add buttons to your blog post content. There are two styles available –

  1. Primary Button: Class name .button--primary

  2. Secondary Button: Class name .button--secondary

To add a button, click the "+" icon next to the line in Ghost editor and select HTML. Then add anchor tags with the class of the button you want to use. For example, to add a primary button you would paste the following HTML:

<a href="http://example.com" class="button--primary">Primary</a>

Check out the Style Guide to see how buttons look.

Keeping Your Theme Updated

Keeping your theme updated with its latest releases can be a little challenging if you have lots of customizations. We would recommend the following ways:

  • Use Git version control. You can create two branches. One will have your customized theme and one will have the original theme. When an update is released, you can commit the update to the original branch. Then you would switch over to your customization branch and rebase it with the original branch.

  • Another choice is to manually apply the updates to files changed from the Changelog.

  • Another good practice is to keep third-party scripts like Google Analytics in code injection.

Sources and Credits

Thanks to the following services and libraries used in building this theme:

Support

Thank you for using our themes. If you have any questions that are beyond the scope of this documentation, please feel free to email us at [email protected]. We'll do our best to assist you.

Thanks so much!