Back to Documentations

Krabi Documentation

Theme version: 1.1.8 — 22 July 2022 Changelog

Theme Editing & Tools

Edit the theme files mentioned here with a code editor. I recommend Visual Studio Code, Sublime Text, or Atom. Don’t use TextEdit on Mac.

Once you finish, zip the theme files, and upload the final zip file to your Ghost website.

If editing the routes.yaml file, make sure to upload it after every change you make.


Watch the following short video tutorial about theme editing.


If you are looking for Ghost hosting, I recommend Ghost(Pro).

Table of Contents


Theme Installation

The first step is to unzip the downloaded package by double-clicking it on Mac or by right-clicking and selecting “Extract All” in Windows.

Inside the new folder krabi, you will find the krabi.zip theme file and an online documentation file.

Follow these steps to upload the theme to your website:

  1. Log in to your Ghost website admin (example.com/ghost).
  2. Click the settings icon ( ) at the bottom of the left-hand side.
  3. Go to Design > Change theme.
  4. Click Upload theme and select the krabi.zip theme file.
  5. Once uploaded, click Activate now to activate Krabi.

Upload the routes.yaml File (⚑ Required)

To upload the file, follow these steps:

  1. Unzip the krabi.zip theme file.
  2. In your Ghost admin, click the settings icon ( ) at the bottom of the left-hand side.
  3. Go to the Labs.
  4. Scroll down to the Routes section and click the Upload routes YAML button.
  5. Select and upload the routes.yaml file inside the theme folder.
Upload a routes file in Ghost

Note: upload routes.yaml after uploading the theme zip

There will already be a default routes.yaml file uploaded to Ghost. You need to upload your theme’s routes.yaml to override the default.

Upload the routes.yaml file separately after uploading your theme zip file.


Members / Subscriptions

Krabi has different interface elements for membership feature.

  • Log in and Subscribe buttons in the header
  • Sidebar and Footer subscription forms
  • A post subscription form
  • Call to action section on the post page to encourage visitors to subscribe if the post is for members only

If the visitor is already logged in, all the forms will be hidden automatically.

Add the following CSS code into the Ghost admin Code Injection Site Header.

<style>
  .c-header .is-membership { display: none; }
</style>

Click Save. That’s all.

This will also remove the Account and Log out links, visible if logged in.

An alternative way is to remove them from the theme, open the partials/header.hbs theme file using a code editor, remove lines 31 to 36.

Once you finish, zip the theme files, and upload the final zip file to your Ghost website.

Remove ‘Public’, ‘Members’ and ‘Paid’ Labels from Post Card

Open the partials/post-card.hbs file and remove lines 23 to 27.

Once you finish, zip the theme files, and upload the final zip file to your Ghost website.

Or, copy and paste the following CSS code into the Ghost admin Code Injection Site Header.

<style>
  .c-post-card__visibility { display: none; }
</style>

Remove Subscribe Form From Sidebar

To remove the Subscribe form from the header, open the partials/sidebar.hbs theme file using a code editor and remove line 2.

Once you finish, zip the theme files, and upload the final zip file to your Ghost website.

To remove the subscribe box from site footer, open the partials/footer.hb theme file using a code editor and remove lines from 18 to 23.

Once you finish, zip the theme files, and upload the final zip file to your Ghost website.

Remove Subscribe Form From the Article Page

To remove the subscribe box on the article page. Open the post.hbs theme file using a code editor and remove line 41.

Once you finish, zip the theme files, and upload the final zip file to your Ghost website.

Add Name Field to the Subscribe Form

To add a name field to the subscribe form, add the following code to the partials/subscribe-form.hbs theme file using a code editor after the label line.

<input type='text' name='name' class='c-subscribe-form__input' placeholder='' required data-members-name>

The name field will now be visible in the sidebar, post, and footer forms.

In the partials/post-subscribe-form.hbs theme file, remove the c-subscribe-form--compact class from the form – line 12, which will fix the form style after adding the name field.

Change Subscribe Form Text and Background Colors

Add the following code into the Ghost admin Code Injection Site Header and change the uppercase values with your with your HTML color code, e.g., #942d76;

<style>
  .c-subscribe {
    color: YOUR_COLOR;
    background-color: YOUR_BACKGROUND_COLOR;
  }
</style>

Embed Subscribe Form in a Post

To add the Subscribe Form in the middle of a blog post, click on the + button and choose the HTML card.

Ghost HTML CARD

Then paste the following code into the editor field and save your post.

<section class="c-subscribe">
  <div class="c-subscribe__content c-subscribe__content--center">
    <h4 class="c-subscribe__title u-type-500 u-mb-8">Krabi Newsletter</h4>
    <p class="u-type-500 u-mb-16">Join the newsletter to receive the latest updates in your inbox.</p>
    <form data-members-form="signup" class="c-subscribe-form c-subscribe-form--compact">
      <div class="form-group">
        <label for="subscribe-email-post" class="u-screenreader-only">Your email address</label>
        <input type="email" name="email" class="c-subscribe-form__input" id="subscribe-email-post" placeholder="Your email address" required="" data-members-email="">
        <button type="submit" value="Subscribe" class="c-btn c-subscribe-form__btn">Subscribe</button>
      </div>

      <div class="c-alert c-alert--success">Please check your inbox and click the link to confirm your subscription.</div>
      <div class="c-alert c-alert--invalid">Please enter a valid email address!</div>
      <div class="c-alert c-alert--error">An error occurred, please try again later.</div>
    </form>
  </div>

  <div class="c-subscribe__icon">
    <svg height="300px" width="300px" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" x="0px" y="0px" viewBox="0 0 100 100"><g transform="translate(0,-952.36218)"><path style="text-indent:0;text-transform:none;direction:ltr;block-progression:tb;baseline-shift:baseline;color:#000000;enable-background:accumulate;" d="m 16.999997,973.36216 c -4.4386,0 -7.9999997,3.7333 -7.9999997,8.2188 l 0,41.53124 c 0,4.4854 3.5613997,8.25 7.9999997,8.25 l 66.000006,0 c 4.4386,0 8,-3.7646 8,-8.25 l 0,-41.53124 c 0,-4.4855 -3.5614,-8.2188 -8,-8.2188 l -66.000005,0 z m 0,4 66.000006,0 c 0.5919,0 1.1508,0.1705 1.6562,0.4062 L 52.468798,1008.331 c -1.4774,1.4026 -3.3951,1.4027 -4.875,0 l -32.25,-30.56264 c 0.5054,-0.2357 1.0643,-0.4062 1.6562,-0.4062 z m -3.9375,3.75 22.7813,21.59384 -22.4063,22.375 c -0.2806,-0.5827 -0.4375,-1.2497 -0.4375,-1.9688 l 0,-41.53124 c 0,-0.1624 0.047,-0.3123 0.062,-0.4688 z m 73.875006,0 c 0.016,0.1565 0.062,0.3064 0.062,0.4688 l 0,41.53124 c 0,0.7087 -0.1644,1.3609 -0.4375,1.9375 l -22.343705,-22.375 22.718705,-21.56254 z m -25.625005,24.34384 21.875005,21.9062 c -0.063,0 -0.1241,0 -0.1875,0 l -66.000005,0 c -0.053,0 -0.104,0 -0.1562,0 l 21.9062,-21.875 6.0938,5.75 c 2.9023,2.7512 7.4733,2.7551 10.375,0 l 6.0937,-5.7812 z" fill-opacity="1" stroke="none" marker="none" visibility="visible" display="inline" overflow="visible"></path></g></svg>
  </div>
</section>
Subscribe Form Embed

The result.

Subscribe Form Embed

Demo.

To embed the sidebar subscribe form style, use the following code.

<div class="c-subscribe">
  <div class="c-subscribe__content">
    <h4 class="c-subscribe__title u-type-500 u-mb-8">Krabi Newsletter</h4>
    <p class="u-type-500 u-mb-16">Join the newsletter to receive the latest updates in your inbox.</p>
    <form data-members-form="signup" class="c-subscribe-form ">
      <div class="form-group">
        <label for="subscribe-email-sidebar" class="u-screenreader-only">Your email address</label>
        <input type="email" name="email" class="c-subscribe-form__input" id="subscribe-email-sidebar" placeholder="Your email address" required="" data-members-email="">
        <button type="submit" value="Subscribe" class="c-btn c-subscribe-form__btn">Subscribe</button>
      </div>

      <div class="c-alert c-alert--success">Please check your inbox and click the link to confirm your subscription.</div>
      <div class="c-alert c-alert--invalid">Please enter a valid email address!</div>
      <div class="c-alert c-alert--error">An error occurred, please try again later.</div>
    </form>
  </div>

  <div class="c-subscribe__icon">
    <svg height="300px" width="300px" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" x="0px" y="0px" viewBox="0 0 100 100"><g transform="translate(0,-952.36218)"><path style="text-indent:0;text-transform:none;direction:ltr;block-progression:tb;baseline-shift:baseline;color:#000000;enable-background:accumulate;" d="m 16.999997,973.36216 c -4.4386,0 -7.9999997,3.7333 -7.9999997,8.2188 l 0,41.53124 c 0,4.4854 3.5613997,8.25 7.9999997,8.25 l 66.000006,0 c 4.4386,0 8,-3.7646 8,-8.25 l 0,-41.53124 c 0,-4.4855 -3.5614,-8.2188 -8,-8.2188 l -66.000005,0 z m 0,4 66.000006,0 c 0.5919,0 1.1508,0.1705 1.6562,0.4062 L 52.468798,1008.331 c -1.4774,1.4026 -3.3951,1.4027 -4.875,0 l -32.25,-30.56264 c 0.5054,-0.2357 1.0643,-0.4062 1.6562,-0.4062 z m -3.9375,3.75 22.7813,21.59384 -22.4063,22.375 c -0.2806,-0.5827 -0.4375,-1.2497 -0.4375,-1.9688 l 0,-41.53124 c 0,-0.1624 0.047,-0.3123 0.062,-0.4688 z m 73.875006,0 c 0.016,0.1565 0.062,0.3064 0.062,0.4688 l 0,41.53124 c 0,0.7087 -0.1644,1.3609 -0.4375,1.9375 l -22.343705,-22.375 22.718705,-21.56254 z m -25.625005,24.34384 21.875005,21.9062 c -0.063,0 -0.1241,0 -0.1875,0 l -66.000005,0 c -0.053,0 -0.104,0 -0.1562,0 l 21.9062,-21.875 6.0938,5.75 c 2.9023,2.7512 7.4733,2.7551 10.375,0 l 6.0937,-5.7812 z" fill-opacity="1" stroke="none" marker="none" visibility="visible" display="inline" overflow="visible"></path></g></svg>
  </div>
</div>

The result.

Subscribe Form Embed

Demo.

To save time each time you add a new form, you can create it as a snippet.

You may be asking, how I got the form HTML code above? Well, you can copy it from your blog or the theme demo source code. You can do this by opening your browser DevTools and select the form element and copy it. Like the following screenshot.

Subscribe Form Embed Source Code

You can use Chrome DevTools or Firefox Developer Tools. To open the DevTools, right-click on an element on the page and choose Inspect, then the Elements panel will open. Also, you can press Command+Option+C (Mac) or Control+Shift+C (Windows, Linux, Chrome OS) to open the Elements panel.

Remove Ghost Portal / The Bottom Right Button

This is the Ghost Portal button; you can disable it from the Ghost admin. More information at Portal Look and feel.

Remove Ghost Portal

Membership Troubleshooting Tips

If for any reason the subscribe form does not work, or there is an error message, the following tips might help:

  1. First, make sure you run the latest version of Ghost.

  2. If you are self-hosting your website, make sure to set up the mail config. After doing that, restart your Ghost server.

  3. The website config URL should match the URL used to access the website, as described in the Ghost docs.

Enter the URL that is used to access your publication. If using a subpath, enter the full path, https://example.com/blog/. If using SSL, always enter the URL with https://..


If you still have an issue using Ghost Pro, please contact the Ghost team. If you use any self-hosting provider, please contact them for help.


There is nothing to do from the theme side. Also, you can try the original theme demo to double-check that everything is working fine.

For more information about Members, connecting Stripe, and setting the package price, check the official Ghost documentation.


You can add, edit, delete, and reorder the navigation menu in Ghost Admin from the Settings → Navigation page.

Ghost navigation menu

To include a static page on your navigation menu, follow these steps.

First, type the page’s name in the label field as you’d like it to appear on your menu.

Ghost label field

Next, click on the item’s URL. The blog URL will already be auto-populated. Add the page slug after the final /. When satisfied with your page configurations, click the Save button.

Like Header Navigation, you can add the footer navigation from the SECONDARY NAVIGATION at section Settings → Navigation page.

Header Tags Menu

The tags menu will automatically show all the blog tags in alphabetical order.

Krabi Tags Menu

Remove Latest Tab

If you want to remove the Latest tab, open the partials/tags-list.hbs theme file using a code editor and remove lines 7 to 9.

Change the Wording or URL on the Latest Tab

If you want to change the wording on the Latest tab, open the partials/tags-list.hbs theme file using a code editor and change line 8 link text. So, for example, if you want to replace Latest with Home, you can do the following.

<a href='/' class='c-tags-list__link'>Home</a>

As shown above, the Latest tab URL will point to the homepage. If you want to point to another page, change the link href attribute / value to your new URL. For example.

<a href='/topics' class='c-tags-list__link'>Home</a>

Show Specefic Tags

If you want to only show specific tags, open the partials/tags-list.hbs theme file using a code editor and replace line 4 with the following line after replacing each TAG_SLUG with your tag Slug.

{{#get 'tags' limit='all' filter='slug:[TAG_SLUG, TAG_SLUG, TAG_SLUG]'}}

So, if you have tag slugs like tech-vc, design, coding, it should be like:

{{#get 'tags' limit='all' filter='slug:[tech-vc, design, coding]'}}

Note the Comma (,) separating each slug.

Tags Note

If the tag is empty with no posts, it will not be visible. Add the tag to any post, and it will appear.

This way does not guarantee to get the same tags in the same order as you added the slugs. Probably a Ghost issue.

Show List of Pages Instead of Tags

If you want to show a list of static pages instead of the tags, open and edit the partials/tags-list.hbs theme file using a code editor.

Instead of the current tags loop code, remove all the Handlebars lines and use the existing HTML markup to add your pages as list items.

So instead of the following code.

{{#get 'tags' limit='all'}}
  <div class='c-tags-list-wrap'>
    <ul class='c-tags-list o-plain-list dragscroll'>
      <li class='c-tags-list__item'>
        <a href='/' class='c-tags-list__link'>{{t 'Latest' }}</a>
      </li>
      {{#foreach tags}}
        <li class='c-tags-list__item'>
          <a href='{{ url }}' class='c-tags-list__link'>{{ name }}</a>
        </li>
      {{/foreach}}
    </ul>
  </div>
{{/get}}

Your code might look like the following.

<div class='c-tags-list-wrap'>
  <ul class='c-tags-list o-plain-list dragscroll'>
    <li class='c-tags-list__item'>
      <a href='/productivity/' class='c-tags-list__link'>Productivity</a>
    </li>
    <li class='c-tags-list__item'>
      <a href='/career/' class='c-tags-list__link'>Career</a>
    </li>
  </ul>
</div>

Remove Tags Menu

If you want to remove the entire tags list, copy and paste the following CSS code into the Ghost admin Code Injection Site Header.

<style>
  .c-tags-list-container { display: none; }
  .c-header { margin-bottom: 32px; }
</style>

Click Save.

You might saw some websites using Krbai with icons in the navigation menu. They are Emojis – :) – and you can add them as part of the nav item text.

Krabi Ghost Theme Navigations Icons/Emojis


Pages

Manage pages for Tags, Authors, and Contact from the Pages section of Ghost admin.

Tags Page

Follow these steps to create the Tags page:

  1. From the Ghost admin Pages section, create a new page and give it a title, like “Tags”.
  2. From Page settings, select the Tags template.
  3. Publish the page.
  4. To add the page to the navigation, please check the Navigation section.
Ghost Tags Page

Note for Self-hosters

If you are self-hosting your website, you may need to do a server restart. This should get the Tags option to show up in the Template dropdown.

Authors Page

To create the Authors page:

  1. Create a new page and give it a title, like “Authors”.
  2. From Page settings, select the Authors template.
  3. Publish the page
  4. To add the page to the navigation, please check the Navigation section above
Ghost Authors Page

Note for Self-hosters

If you are self-hosting your website, you may need to do a server restart. This should get the Authors option to show up in the Template dropdown.

Contact Page

To create the Contact page:

  1. Create a new Page and give it a title, like “Contact”.
  2. Add your content and the contact form code using Formspree as a service. Please check the code example below.
  3. Publish the page.
  4. To add the page to the navigation, please check the Navigation section.
<form action="https://formspree.io/your@email.com" method="POST">
  <input type="text" name="name" placeholder="Name">
  <input type="email" name="_replyto" placeholder="Email">
  <textarea name='message' placeholder="Message"></textarea>
  <input class='c-btn' type="submit" value="Send">
</form>

For more information, check out How to Add a Contact Form to Your Ghost Blog.


Comments

The theme supports comments from Disqus, Commento, and CommentBox.

If you display comments for logged-in readers, they will need to log in/register into the comment system again. As you know, Ghost has no comment system, and these are third-party tools that are not integrated with and not part of Ghost.

Please contact their authors or check out their documentation for questions or issues about the commenting systems.

Disqus

To enable Disqus as a comments system, open the partials/disqus.hbs theme file using a code editor. Replace the aspirethemes-demos value with the disqus_shortname variable to match your Disqus account shortname.

var disqus_shortname = 'aspirethemes-demos';

So, if your Disqus shortname is exampleone, the final code above should be:

var disqus_shortname = 'exampleone';

Once you finish, zip the theme files, and upload the final zip file to your Ghost website.

From the theme side, that’s all you need to set up Disqus. If you have any issues with comments not loading, make sure you have registered your website with Disqus (Step 1).

If you still have issues, check the Disqus troubleshooting guide.

Disable Disqus

To disable Disqus comments, open the post.hbs theme file using a code editor and delete the line containing the {{> disqus}} text (line 43).

Once you finish, zip the theme files, and upload the final zip file to your Ghost website.

A quick way to disable Disqus is to copy and paste the following CSS code into the Ghost admin Code Injection Site Header.

<style>
  #disqus_recommendations, #disqus_thread { display: none; }
</style>

Disable Disqus Recommendations/Ads

Checkout the Disqus Recommendations documentation.

Disable Disqus Recommendations/Ads

Disqus Issues

If you have any issue with Disqus redirecting to any advertising pages, please disable Tracking and Affiliate Links from your Disqus account.

Check out Keegan Leary’s blog post about this issue at https://keeganleary.com/disqus-is-evil-trash/.

Also, be aware of Disqus trackings. Check out https://supunkavinda.blog/disqus.

So, you might want to use another commenting system.

Thanks for sharing, Keegan!

CommentBox

To enable CommentBox as a comments system, open post.hbs file and replace line 43 replace with {{> commentbox}}.

The next step is to create a CommentBox account. From the dashboard, create a new project by filling in your site information. You will then receive a Project ID.

Copy that Project ID, open the partials/commentbox.hbs theme file using a code editor and replace the my-project-id value with it. That’s it.

Commento

To enable Commento as a comments system, open the post.hbs theme file using a code editor and replace line 43 with {{> commento}}.

The next step is to create a Commento account and register your domain with it.

Show Comments for Signed-in Visitor Only

If you want to show comments for only signed-in visitor, open the post.hbs theme file using a code editor and replace line 43 ({{> disqus}}) with the following code.

{{#if @member}}
  {{> disqus}}
{{/if}}

You can read more about Ghost visibility choices at Content visibility.


Typography Drop Caps

The theme comes with different styles of typography drop caps. It will apply to the first letter of the first word on a given paragraph.

To add a drop cap style to a paragraph.

  1. Add an HTML card to your Post or Page content editor
  2. In that HTML card, add a <p> </p> HTML element with the Drop Cap CSS class. For example, <p class='u-drop-cap--small'> </p>. Check below for the available classes for each style
  3. Add your paragraph text whith that <p> </p> HTML element
Krabi Ghost Theme Typography Dropcap HTML card

There are currently six styles available.

➊ Small Drop Cap

  • CSS class → u-drop-cap--small
  • Example ↓
<p class='u-drop-cap--small'>TEXT HERE</p>

The result.

Krabi Ghost Theme Typography Dropcap

➋ Medium Drop Cap

  • CSS class → u-drop-cap--medium
  • Example ↓
<p class='u-drop-cap--medium'>TEXT HERE</p>

The result.

Krabi Ghost Theme Typography Dropcap Medium

➌ Large Drop Cap

  • CSS class → u-drop-cap--large
  • Example ↓
<p class='u-drop-cap--large'>TEXT HERE</p>

The result.

Krabi Ghost Theme Typography Dropcap Large

➍ Block/Small Drop Cap

  • CSS class → u-drop-cap--block-small
  • Example ↓
<p class='u-drop-cap--block-small'>TEXT HERE</p>

The result.

Krabi Ghost Theme Typography Dropcap Block Small

➎ Block/Medium Drop Cap

  • CSS class → u-drop-cap--block-medium
  • Example ↓
<p class='u-drop-cap--block-medium'>TEXT HERE</p>

The result.

Krabi Ghost Theme Typography Dropcap Block Medium

➏ Block/Large Drop Cap

  • CSS class → u-drop-cap--block-large
  • Example ↓
<p class='u-drop-cap--block-large'>TEXT HERE</p>

The result.

Krabi Ghost Theme Typography Dropcap Block Large

To save time each time you create a new Drop Cap, you can create it as a snippet.


Content Notes

Use Content Notes to show content in a different style. Notes are helpful if you want to get your reader’s attention to important information within your article.

Krabi Content Notes

To add a Note section.

  1. Add an HTML card to your Post or Page content editor
  2. In that HTML card, add a <div> </div> HTML element with the Note CSS class. For example, <div class='c-note'> </div>. Check below for the available classes for each style
  3. You can then add an inner HTML element, for example, a paragraph, or a list item. Check below for an example
Krabi Ghost Theme Content Note HTML card

There are currently five styles available.

➊ Default Style

  • CSS class → c-note
  • Example ↓
<div class='c-note'>
  <p>ADD YOUR TEXT HERE</p>
</div>

The result.

Krabi Ghost Theme Content Note Dafault HTML card Style

➋ Info Style

  • CSS class → c-note c-note--info
  • Example ↓
<div class='c-note c-note--info'>
  <p>ADD YOUR TEXT HERE</p>
</div>

The result.

Krabi Ghost Theme Content Note Info HTML card Style

➌ Success Style

  • CSS class → c-note c-note--success
  • Example ↓
<div class='c-note c-note--success'>
  <p>ADD YOUR TEXT HERE</p>
</div>

The result.

Krabi Ghost Theme Content Note Success HTML card Style

➍ Warning Style

  • CSS class → c-note c-note--warning
  • Example ↓
<div class='c-note c-note--warning'>
  <p>ADD YOUR TEXT HERE</p>
</div>

The result.

Krabi Ghost Theme Content Note Warning HTML card Style

➎ Danger Style

  • CSS class → c-note c-note--danger
  • Example ↓
<div class='c-note c-note--danger'>
  <p>ADD YOUR TEXT HERE</p>
</div>

The result.

Krabi Ghost Theme Content Note Warning HTML card Style

To save time each time you create a new Note, you can create it as a snippet.


Table of Contents

Add a table of contents to your posts and pages automatically.

The table of contents section will show the post headings h2 and h3 supported by the Ghost editor. If none of these headings exist in post content, the table of contents section will be hidden.

Krabi Table of Contents

Activate on All Posts & Pages

The table of contents block is invisible by default. Go to Settings > Design > Site design > Post to activate it. You have two options:

  1. Show table of contents on all posts
  2. Show table of contents on all pages
Krabi Table of Contents activation

Activate on Individual Posts & Pages

Make sure that show the table of content on all posts and pages options are not active.

Create a new Internal tag from the admin Tags page and set the Name to: #table-of-content

Krabi Table of Contents Hash Tag

You can now assign the #table-of-content tag to a post or a page, and the table of contents will only be visible to that post or page.

Krabi Table of Contents Post Settings

Note for fixed header

If you are using fixed header, add the following CSS code into the Ghost admin Code Injection Site Header.

<style>
  .c-content h2,
  .c-content h3 {
    scroll-margin-top: 72px;
  }
</style>

Remove Numbering From Table of Contents

Copy and paste the following CSS code into the Ghost admin Code Injection Site Header.

<style>
  .c-table-of-contents__list { list-style: none; padding: 0; }
  .c-table-of-contents__list:first-child { margin: 0; }
</style>

Show Authors

The theme lets you control how and where you show authors.

The sidebar Authors section shows three authors ordered by post count.

To remove this section, open the partials/sidebar.hbs theme file using a code editor and remove line 8 ({{> sidebar-authors }}).

Article Authors

The article page will show Authors info in two places.

In the top header, under the title, and near the social sharing icons. To remove, copy and paste the following CSS code into the Ghost admin Code Injection Site Header.

<style>
  .c-post-header__authors-names,
  .c-post-header__authors-images { display: none; }
</style>

And under the article content. To remove, copy and paste the following CSS code into the Ghost admin Code Injection Site Header.

<style>
  .c-card-author { display: none; }
</style>

Post Card Authors

To remove, copy and paste the following CSS code into the Ghost admin Code Injection Site Header.

<style>
  .c-post-card__authors-images,
  .c-post-card__authors-names { display: none; }
</style>

Posts Per Page

You can control how many posts display per page from the package.json file.

"config": {
  "posts_per_page": 8
}

The theme default value is set to 8 posts per page.


Related posts section will be visible at the bottom of a post if other posts share the same tags as the current post.


Scroll to Top Button

The button will appear at the website bottom right after you scroll. Clicking the button will take you to the page top. Visible at large screens.

Krabi Scroll to Top Button

Activate

The button is invisible by default. Go to Settings > Design > Site design > Site-wide and activate the Show scroll to top button option.

Krabi Scroll to Top Button activation

Scroll to Top & Portal buttons

If you use the membership Portal, the Scroll to Top and the Portal buttons will be in the same place, the bottom right of your website. You might not see the Scroll to Top button as it will be behind the Portal one. Decide which one to keep. I will think about more options to keep both in the future. Let me know what you think.


Google Analytics

To integrate Google Analytics, I recommend using the Google Analytics integration by Ghost.


Update Favicon

You can change the favicon from the Ghost admin Settings > Design > Site design > Brand > Publication icon.


Responsive Tables

Responsive tables are required and essential for adding tabular content and allowing tables to be scrolled horizontally. You can make any table responsive across all viewports by wrapping a table with .responsive-table, for example:

<div class='responsive-table'>
  <table>
    ...
  </table>
</div>

Social Sharing Icons

You can customize and update a post’s social media sharing icons from the partials/share.hbs theme file.


Sidebar social media links are placed in the partials/sidebar-social-icons.hbs file.

Ghost supports adding Facebook and Twitter profile URLs from the admin panel. Go to General > Social accounts and add your URLs. This will update Facebook and Twitter URLs within the footer social media section.

Ghost CMS Theme Social Accounts

Krabi supports adding Instagram, YouTube, Pinterest, YouTube, and LinkedIn URLs. Go to Settings > Design > Site-wide.

Krabi Ghost Theme Social Media Accounts Settings

If you want to add new social media links not available in the theme or Ghost settings shown above, you can do that in the partials/sidebar-social-icons.hbs file. You will find the icon’s code that comes with the theme in the Available Social Media Icons section.

For example, to add a new social line for GitHub, your code will be like:

<li class='c-social-icons__item'>
  <a href='https://www.github.com/github/'>
    <span class='c-social-icons__icon' data-icon='ei-sc-github' data-size='s'></span>
    <span class='u-hidden-visually'>GitHub</span>
  </a>
</li>

The code above contains the icon code from the above list and the social media link (a) within a list element (li).

Next, replace your GitHub full URL with the link href value. If your GitHub URL is:

https://www.github.com/github/

Then the final code will be:

<li class='c-social-icons__item'>
  <a href='https://www.github.com/github/'>
    <span class='c-social-icons__icon' data-icon='ei-sc-github' data-size='s'></span>
    <span class='u-hidden-visually'>GitHub</span>
  </a>
</li>

Once you finish, zip the theme files, and upload the final zip file to your Ghost website.

Available Social Media Icons

The theme uses Evil Icons to provide simple and clean icons for other social accounts. Here you can find a list of the social media icons to use:

Facebook

<span class='c-nav__item__icon' data-icon='ei-sc-facebook' data-size='s'></span>

GitHub

<span class='c-nav__item__icon' data-icon='ei-sc-github' data-size='s'></span>

Instagram

<span class='c-nav__item__icon' data-icon='ei-sc-instagram' data-size='s'></span>

LinkedIn

<span class='c-nav__item__icon' data-icon='ei-sc-linkedin' data-size='s'></span>

Odnoklassniki

<span class='c-nav__item__icon' data-icon='ei-sc-odnoklassniki' data-size='s'></span>

Pinterest

<span class='c-nav__item__icon' data-icon='ei-sc-pinterest' data-size='s'></span>

Skype

<span class='c-nav__item__icon' data-icon='ei-sc-skype' data-size='s'></span>

SoundCloud

<span class='c-nav__item__icon' data-icon='ei-sc-soundcloud' data-size='s'></span>

Telegram

<span class='c-nav__item__icon' data-icon='ei-sc-telegram' data-size='s'></span>

Tumblr

<span class='c-nav__item__icon' data-icon='ei-sc-tumblr' data-size='s'></span>

Twitter

<span class='c-nav__item__icon' data-icon='ei-sc-twitter' data-size='s'></span>

Vimeo

<span class='c-nav__item__icon' data-icon='ei-sc-vimeo' data-size='s'></span>

VK

<span class='c-nav__item__icon' data-icon='ei-sc-vk' data-size='s'></span>

Youtube

<span class='c-nav__item__icon' data-icon='ei-sc-youtube' data-size='s'></span>

Languages

Krabi comes in many languages already. But if you’d like to add another one, you’ll be able to do that too.

Theme Translation

Krabi supports Ghost i18n and comes with Arabic, German, Italian, Spanish, French, Finnish, Portuguese Dutch, Turkish, and Danish translations.

To use a language other than English, go to Admin > General > PUBLICATION INFO > Publication Language and enter the ISO Code.

The following is a list of the available theme languages with the code to use.

  • ar for Arabic
  • da for Danish
  • de for Germany
  • en for English
  • es for Spanish
  • fi for Finnish
  • fr for French
  • it for Italian
  • nl for Dutch
  • pt for Portuguese
  • tr for Turkish
Ghost Publication Language Setting

Add a New Language Translation

If the theme does not have a translation for your language, follow the following steps to add a new language translation.

  1. Create a new file using a code editor in the theme’s locales folder with the ISO Language Codes code. Foe example, if the new language is Japanese, the ISO code will be jaand the file name will be ja.json.
  2. In the same locales folder, open the en.json file and copy its content into your new language file.
  3. Start translating, as shown in the following Edit Translation section.
  4. Go to your Ghost admin Settings > General > PUBLICATION INFO and enter your language ISO code into the Publication Language field. For example, ja.
  5. Click Save settings.

Once you finish, zip the theme files, and upload the final zip file to your Ghost website.

You may want to restart Ghost or deactivate and activate the theme again to make the new changes effective.

Edit Translation

To improve or edit a translation in a specific available language, you can open the language file using a code editor in the locales folder:

|____locales
| |____ar.json
| |____da.json
| |____de.json
| |____en.json
| |____es.json
| |____fi.json
| |____fr.json
| |____it.json
| |____nl.json
| |____pt.json
| |____tr.json

For example, the German translation file — de.json — looks like this:

{
  "Skip to content": "Zum Inhalt springen",
  "Scroll to Top": "Nach oben scrollen",
  "Table of Contents": "Inhaltsverzeichnis",

  "Loading": "Wird geladen",
  "More Posts": "Weitere Artikel",

  "Recent Posts": "kürzliche Artikel",
  "Featured Posts": "Beliebte Beiträge",
  "Page Not Found": "Seite nicht gefunden",
  "You might also like": "Das könnte Sie auch interessieren:",
  "Latest": "Neueste",
  "Authors": "Autoren",
  "Navigation": "Navigation",
  "Newsletter": "Newsletter",
  "Published with {ghostLink} & {themeLink}": "Veröffentlicht mit {ghostLink} & {themeLink}",

  "Share on Twitter": "Auf Twitter teilen",
  "Share on Facebook": "Auf Facebook teilen",
  "Share on LinkedIn": "Auf LinkedIn teilen",
  "Share on Pinterest": "Auf Pinterest teilen",
  "Share via Email": "Per E-Mail teilen",
  "Copy link": "Link kopieren",
  "Link copied to clipboard": "Link in die Zwischenablage kopiert",

  "Search": "Suche",
  "Search {siteTitle}": "Suche {siteTitle}",
  "Type to Search": "Suchbegriff(e) eingeben",

  "Paid": "Bezahlt",
  "Members": "Mitglieder",
  "Public": "Öffentlichkeit",

  "Account": "Konto",
  "Log in": "Einloggen",
  "Continue": "Fortsetzen",
  "Subscribe": "Abonnieren",
  "Subscribe Now": "Abonniere jetzt",
  "Your email address": "Deine E-Mail-Adresse",
  "{siteTitle} Newsletter": "{siteTitle} Newsletter",
  "Please check your inbox and click the link to complete the login.": "Bitte überprüfen Sie Ihren Posteingang und klicken Sie auf den Link, um die Anmeldung abzuschließen.",
  "Please check your inbox and click the link to confirm your subscription.": "Bitte überprüfen Sie Ihren Posteingang und klicken Sie auf den Link, um Ihr Abonnement zu bestätigen.",
  "Please enter a valid email address!": "Bitte geben Sie eine gültige E-Mail-Adresse ein!",
  "An error occurred, please try again later.": "Ein Fehler ist aufgetreten. Bitte versuchen Sie es später erneut.",

  "Already have an account?": "Hast du schon ein Konto?",
  "Don't have an account yet?": "Sie haben noch keinen Account?",

  "This post is for paying subscribers only": "Dieser Beitrag ist nur für zahlende Abonnenten",
  "This post is for subscribers only": "Dieser Beitrag ist nur für Abonnenten",
  "This post is for subscribers on the ": "Dieser Beitrag ist für Abonnenten der ",
  "This page is for paying subscribers only": "Diese Seite ist nur für zahlende Abonnenten",
  "This page is for subscribers only": "Dieser Seite ist nur für Abonnenten",
  "This page is for subscribers on the ": "Diese Seite ist für Abonnenten der ",
  "Upgrade your account": "Aktualisieren Sie Ihr Konto",

  "Join the newsletter to receive the latest updates in your inbox.": "Treten Sie dem Newsletter bei, um die neuesten Updates in Ihrem Posteingang zu erhalten"
}

Each line consists of a left key ("More Posts") and a right value ("Mehr Artikel").

The key is plain English that exists in all translation files and should not be changed. You should change only the value.

If you have any suggestions to improve a current translation or add a new language, please contact me.

Portal Text & Translation

There is no way to change or translate the Portal text yet. The Portal is not part of the theme files but a core Ghost component.

I suggest reaching out to the Gost team ( support@ghost.org ); so they might work on this issue or have a workaround.

RTL

RTL means right to left. Turning on RTL makes the theme readable for languages written from right to left, like Arabic or Hebrew.

To enable the RTL option, open the partials/head.hbs theme file using a code editor and change line 9 to {{> compiled/inline-css-rtl }}.

Save the file and upload the theme to your Ghost blog.

Once you finish, zip the theme files, and upload the final zip file to your Ghost website.

Multiple Languages Support

The theme supports Ghost translations for different languages, which means if you set the site language to French, some parts of the theme will change to French, for example, button labels.

On the other hand, having multiple languages on one website is not supported out of the box in Ghost, so the theme. This guide by Ghost explains how to configure multiple languages. I have not tried it, but it might be a good starting point.


Syntax Highlighting

You can add a fenced code block by placing triple backticks ``` before and after the code block. For example:

```
pre {
  background-color: #f4f4f4;
  max-width: 100%;
  overflow: auto;
}
```

This will produce the following gray look:

Krabi Ghost Theme Syntax Highlighting

To highlight a code block, add the language alias like css or js to the code block. For example, the CSS code in the previous example will wrap between ```css and ``` as follows:

```css
pre {
  background-color: #f4f4f4;
  max-width: 100%;
  overflow: auto;
}
```

This will produce the following colored look:

Krabi Ghost Theme Syntax Highlighting with prismjs

To add inline code, wrap the text between two backticks ` `.

Prism

Krabi ships with Prism.js, a lightweight, robust, and elegant syntax highlighter.

The initial Prism package includes some languages, like Markup, CSS, C-like, and JavaScript.

You can add support for more languages. For example, to add support for PHP, get the PHP component script from Prism CDN.

<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.13.0/components/prism-php.js"></script>

From the side admin menu, go to Code Injection and add the script to the Site Footer section. Be sure to click Save.

Krabi Ghost Theme Syntax Highlighting Code Injection PHP Prism

Post Feature Image Size

An image width of (692px × 390px) would fit the homepage cards and the post header.

You can also use an image with a double size (1384px × 780px) for a high-resolution image preview.


Footnotes

Ghost has limited support for footnotes, which means it doesn’t support footnotes outside of the editor Markdown card. So, if your article content will all be in Markdown, this will work fine for you.

For creating a footnote, check out the Markdown Guide – Footnotes for more information about the syntax. You can check out how the theme renders this example in the demo. So, in your editor, you need to add a new Markdown card and then add your footnote inside.

The theme will render what the editor can do; the theme has no built-in footnotes support but Ghost. Check out this theme demo example.

Check out this Forum discussion for more information and probably some ideas and workarounds. Someone suggests bigfoot, and another one adds it manually.

I have not done any work to support footnotes beyond the basic Ghost Markdown implementation, so I’m afraid I can’t give any advice here.


Theme Deploy with GitHub Actions

Krabi comes integrated with the Deploy Ghost Theme Github action. The purpose of the GitHub action is to take the theme from the GitHub repo and send it to your website.

Krabi documentation Ghost CMS Theme GitHub Actions

I have written about this in How to Deploy Your Ghost Theme Using Github Actions. All you need to do is follow steps 1 and 2.

The Deploy Ghost Theme action is software by Ghost and works with any Ghost install, whether you self-host Ghost or use Ghost Pro.


Code Injection

Another choice for customization is to use the Ghost Code Injection settings in Ghost admin.

For a CSS example, you can use the following code in the Site Header section to change the logo color and font size.

<style>
  .c-logo__link {
    color: #4550E5;
    font-size: 32px;
  }
</style>

Watch the following short video about Ghost Code Injection, how it works, and how to use it.


Changing Colors

In this section, you will learn about changing the website Accent color and also how to change the theme color scheme with CSS variables.

Set Accent Color

Change the Accent color from the admin Settings > Design > Brand > Accent color.

Accent color used throughout the theme in buttons background, quotes border,…

Krabi demo Accent color is: 5869DA (the blue color).

Ghost Accent Color Setting

Changing Colors with CSS Variables

You can use Code Injection to change the other theme colors with CSS Variables.

For the list of available theme color variables, check out the assets/sass/settings/_colors.scss theme file — dont’t change the colors in this file, use it only as a reference for the available CSS Variables and instead use Code Injection as mentioned below to change the colors.

The _colors.scss will look like this:

:root {
  --color-text-primary:   #000C2D;
  --color-text-secondary: #687385;
  --color-text-white:     #FFFFFF;
  --color-text-error:     #A01F1F;
  --color-text-success:   #085E38;

  --color-background-primary:   #F5F7F9;
  --color-background-secondary: #FFFFFF;
  --color-background-info:      #F3F6FF;
  --color-background-success:   #ECFDF5;
  --color-background-warning:   #FFFAF2;
  --color-background-danger:    #FDF4F4;

  --color-border-primary:  #DFE3E9;
  --color-border-info:     #3366FF;
  --color-border-success:  #52BD95;
  --color-border-warning:  #FFB020;
  --color-border-danger:   #D14343;

  --color-subscribe-form-icon: #021637;
  --color-background-subscribe-form: var(--color-text-primary);
}

For example, if you wanted to change the theme’s text color, you’d change #000C2D in the --color-text-secondary variable. You can copy the color variable to Code Injection > Site Header and assign it your new color, as in the following example.

<style>
  :root {
    --color-text-secondary: #000000;
  }
</style>

If, for example, you want to add a color that’s not in the available theme variables or add another style to a new element, you can create a new variable and give it a name and value.

We can extend the previous example to add a new color for the logo color and assign that variable to the .c-logo__link class.

<style>
  :root {
    --color-text-secondary: #000000;
    --color-text-logo: #0000FF;
  }

  .c-logo__link {
    color: var(--color-text-logo);
  }
</style>

The logo will then have a #0000FF color (blue).

Krabi Ghost Theme Changing Colors with CSS Variables

Customize Image Height

If you want to customize the height of the images on the home page or the article page, you can use the following CSS code.

For a single post image, the theme default value is 56.25%. You can change this value to match your preference.

.c-post-image-wrap:after {
  padding-bottom: 56.25%;
}

For the homepage cards, the theme default value is also 56.25%.

.c-post-card__image-wrap {
  padding-top: 56.25%;
}

The full code in Code Injection would be:

<style>
  .c-post-image-wrap:after {
    padding-bottom: 56.25%;
  }

  .c-post-card__image-wrap {
    padding-top: 56.25%;
  }
</style>

You may also change the image object-fit CSS value to contain.

Single post image.

<style>
  .c-post-media__image { object-fit: contain; }
</style>

Homepage cards.

<style>
  .c-post-card__image { object-fit: contain; }
</style>

Customize Logo Size

If you are using an image as a logo (instead of the site name) and want to change the logo size, use the following code in Code Injection.

<style>
  .c-logo__img {
    max-height: 32px;
  }
</style>

The default value is 32px, so you can increase this value to match your preference.

If the logo image has a large white space around it, trim that space with a photo editing app for better results.


Center Post Page

Post Content Center

To center the blog post content and remove the sidebar, follow these steps.

  1. Duplicate the default.hbs file and give it another name, for example, default-center.hbs. Then, remove lines 17 to 19.
  2. In the post.hbs file, change the first line to {{!< default-center}}.

That’s all that you need to do. The post will be centered automatically.

Center Posts as an Option

The above steps will make all the posts globally centered without a sidebar. To make it an option to choose from while editing a post, make the following changes.

In step 2:

Duplicate the post.hbs file to custom-post-center.hbs

Keep post.hbs as it is. No change.

In custom-post-center.hbs change the first line to {{!< default-center}}.

When editing the post and from the Post settings, select Post from the Template dropdown.

Center Individual Page

If you want to center the individual pages too and remove the sidebar, in step number 2, edit the page.hbs. Change the first line to {{!< default-center}}.

Center Pages as an Option

The above steps will make all the posts globally centered without a sidebar. To make it an option to choose from while editing a post, make the following changes.

In step 2:

Duplicate the page.hbs file to custom-page-center.hbs

Keep page.hbs as it is. No change.

In custom-page-center.hbs change the first line to {{!< default-center}}.

When editing the post and from the Post settings, select Page Center from the Template dropdown.

In case you want to add a wide and full-width style to images, you can add the following CSS code to the Code Injection (Site Header) section.

<style>
  .kg-width-full {
    width: auto;
  }

  @media (min-width: 40em) {
    .kg-width-full .kg-image {
      max-width: 100vw;
      pointer-events: none;
    }
  }

  @media (min-width: 64em) {
    .kg-width-wide {
      width: 100vw;
      max-width: 1140px;
      padding-left: 40px;
      padding-right: 40px;
    }
  }
</style>

Add Custom Homepage

Follow the next steps to add a custom homepage to your website instead of showing the recent blog posts.

You can also Watch the following video.

Create the home.hbs File

In the root of your Krabi theme, create a new file, and name it home.hbs.

Next, copy the following code to it.

{{!< default}}

{{#page}}

<article class='c-{{ post_class }}'>
  {{> post-header }}

  <section class='c-content'>
    {{ content }}
    <br>
  </section>
</article>

{{/page}}

Once you finish, zip the theme files, and upload the final zip file to Ghost.

Update and Upload the Routes File

Copy the following code to the theme routes.yaml file and then upload it.

routes:
  /:
    data: page.home
    template: home

collections:
  /blog/:
    permalink: /blog/{slug}/
    template: index

taxonomies:
  tag: /tag/{slug}/
  author: /author/{slug}/

That’s all for this step.

To know what’s going on in the above code, we tell Ghost to do the following:

  • Use the home template file for the homepage instead of the index file.
/:
  data: page.home
  template: home
  • Using collections, make the posts available at the /blog/ URL and use the index template file.
collections:
  /blog/:
    permalink: /blog/{slug}/
    template: index

Create the Homepage

In Ghost admin, create a custom homepage as a Ghost Page.

Make sure that the Page URL setting is home.

Krabi Ghost Theme Custom Homepage Setting

Add your content and publish the page.

Now, go to your website homepage, and you should see the homepage becomes the static page you created like the following examples.

Like the regular theme page view, upload a page feature image, and it will be visible first.

Krabi Ghost Theme Custom Homepage

Or skip it and the title will come first.

Krabi Ghost Theme Custom Homepage

Add the Blog Item to the Navigation

After moving the posts to the /blog/ URL you may be asking: How can I access this URL without typing it in the browser bar?

You can add it as a Navigation item.

Krabi Ghost Theme Blog Navigation Item

One more thing you might want to change is removing the Latest tab item in the header tags bar. It is no longer describes the destination page, which is the homepage with the latest posts by default. It is now a custom page.

Show recent Posts

Add the code below at the end of the home.hbs file to show the recent posts. The will show the recent two posys. Change the limit number from 2 to any number if you like to show more posts.

<div class='c-title-bar'>
  <h2 class='c-title-bar__title'>{{t 'Recent Posts'}}</h2>
</div>

<div class='js-grid'>
  {{#get 'posts' include='authors,tags' limit='2' as |posts|}}
    {{#if posts}}
      {{#foreach posts}}
        {{> post-card }}
        {{/foreach}}
    {{/if}}
  {{/get}}
</div>

404: Page Not Found

In case you get the 404 message on the homepage, do the following:

  1. Go to Design > Installed Themes section in your Ghost admin.

  2. Then, activate another theme other than Krabi and activate Krabi again.

This should solve the issue.

Change RSS Icon URL

Becuause we moved the posts to the /blog/ URL, the website RSS feed will now be accessed throght /blog/rss/ instead of /rss/. So, we need to change the URL in the sidebar RSS icon. To do this, open the the partials/sidebar-social-icons.hbs theme file using a code editor and change the URL for the RSS link from /rss/ to /blog/rss/.

Homepage Metadata Note

Due to a Ghost limitation not exposing the custom homepage data, the homepage Metadata information will be coming from the admin General and Branding settings.

  • From the site admin Settings > General, you can set up the Title & description.
  • From the site admin Settings > Design > Brand, you can set up the Publication cover. You can upload the same image as the homepage featured image if you have already uploaded one.

Metadata is helpful for Search Engine Optimization and sharing your website on social media sites to have a nice-looking preview.


The Twitter card and Facebook card meta settings under Settings > General are helpful if you want to customize the look for these specific sites.


It might take some time for the social media site to fetch the new image and to see the changes; give it some time. You can also use a tool like Twitter Card validator for testing.


The featured posts in the sidebar will be part of the homepage posts list. If you want to exclude them from the homepage main posts list, do the following.

Open the theme routes.yaml theme file and copy the following content into it.

routes:
  /:
    controller: channel
    filter: featured:false

collections:
  /:
    permalink: /{slug}/
    template: index

taxonomies:
  tag: /tag/{slug}/
  author: /author/{slug}/

Save and Upload the routes.yaml file to your website.


Include or Exclude Posts With Specific Tag on Homepage

The homepage main posts list will show all the website posts. If you want to exclude posts with specific a Tag and show everything else, do the following.

Open the theme routes.yaml theme file and copy the following content into it.

routes:
  /:
    controller: channel
    filter: tags:-[TAG_SLUG]

collections:
  /:
    permalink: /{slug}/
    template: index

taxonomies:
  tag: /tag/{slug}/
  author: /author/{slug}/

Replace the TAG_SLUG with your Tag Slug. Tag Slug is auto-generated from your Tag Name, and you can find it in the admin Tag page settings.

Alternatively, if you want to include posts from a specific tag and ignore everything else, change the filter value to be:

filter: tags:[TAG_SLUG]

Instead of

filter: tags:-[TAG_SLUG]

Notice the difference is - in front of [].

If you want to exclude posts from different tags, you can add a comma-separated Tag Slug, for example:

filter: tags:-[TAG_SLUG, TAG_SLUG, TAG_SLUG]

Or the following for including specific tags.

filter: tags:[TAG_SLUG, TAG_SLUG, TAG_SLUG]

Save and Upload the routes.yaml file to your website.


In the sidebar Featured Posts widget, do the following: if you want to show posts from a specific tag instead of featured posts.

Open the theme file /partials/sidebar-featured-posts.hbs file and change line 1 from:

{{#get 'posts' filter='featured:true' limit='3' as |posts|}}

To

{{#get 'posts' filter='tags:[TAG_SLUG]' limit='3' as |posts|}}

Replace the TAG_SLUG with your Tag Slug. Tag Slug is auto-generated from your Tag Name, and you can find it in the admin Tag page settings.

If you want to include posts from different tags, you can add a comma-separated Tag Slug, for example:

{{#get 'posts' filter='tags:[TAG_SLUG, TAG_SLUG, TAG_SLUG]' limit='3' as |posts|}}

Once you finish, zip the theme files, and upload the final zip file to your Ghost website.


To control how many featured posts to show on the sidebar widget, do the following.

  1. Open the /partials/sidebar-featured-posts.hbs theme file using a code editor.
  2. Change the limit from the current value, 3 to any number. You can add all to show all the featured posts.

Once you finish, zip the theme files, and upload the final zip file to your Ghost website.


Show Full Post Content Instead of an Excerpt on the Homepage

Open the partials/post-card.hbs file and replace line 30 with the following line.

<div class='c-content u-mt-16'>{{ content }}</div>

Remove Date from All Posts

To remove the date from all posts, add the following CSS code into the Ghost admin Code Injection Site Header section.

<style>
  time { display: none; }
</style>

Click Save.

This code will remove the date from the following:

  • Sidebar postcard
  • Home postcard
  • Post page

Add a New Sidebar Widget

If you want to add a new widget to the sidebar, use the following code as a widget’s skeleton.

To add it to the sidebar, copy and paste it in the /partials/sidebar.hbs theme file before line 9.

<div class='c-widget'>
  <div class='c-title-bar'>
    <h3 class='c-title-bar__title'>YOUR_TITLE</h3>
  </div>

  <div class='u-bg-secondary u-border u-border-radius u-p-32'>
    YOUR_CONTENT_HERE
  </div>
</div>

Here you have two content placeholders.

  • YOUR_TITLE: Replace this with your widget title
  • YOUR_CONTENT_HERE: Replace this with your widget content

If you don’t want to add a title, your skeleton looks like this:

<div class='c-widget'>
  <div class='u-bg-secondary u-border u-border-radius u-p-32'>
    YOUR_CONTENT_HERE
  </div>
</div>

Make Sidebar Sticky

Copy and paste the following CSS code into the Ghost admin Code Injection Site Header.

<style>
  .c-sidebar {
    position: sticky;
    top: 32px;
  }
</style>

Change Subscribe Box Background Icon

You can add your SVG icon to the theme /assets directory, then with CSS in Ghost Code Injection, add it as background as follow:

<style>
  .c-subscribe {
    background-image: url('/assets/icon.svg');
  }
</style>

This will override the current icon. You might also need to configure the background-position to match your icon size.


Fixed Header

To make the header fixed on scroll, use the following CSS code in Ghost Code Injection.

<style>
  body {
    margin-top: 72px;
  }

  .c-header {
    position: fixed;
    top: 0;
    z-index: 3;
    width: 100%
  }
</style>

To make the header fixed only on large screens, use the following code instead.

<style>
  @media (min-width: 64em) {
    body {
      margin-top: 72px;
    }

    .c-header {
      position: fixed;
      top: 0;
      z-index: 3;
      width: 100%
    }
  }
</style>

You will probably need to increase the body margin-top to be more than 72px if you increased the Logo Size.

The result will look like this:

Krabi Ghost Theme Fixed Header

This will make the header fixed but not the tags menu.


Open Post Links in a New Tab

To open the post links in a new tab, add the following script in the Code Injection Site Footer section.

<script>
  document.querySelectorAll('.c-post a').forEach(function (e) {
    if (e.hostname !== window.location.hostname) {
      e.target = '_blank';
    }
  });
</script>

Thanks, Taylor.N, for sharing this snippet!


Change Blockquote Style

If you think the blockquote style is a bit large, you can customize it with CSS. Use the following CSS code in Ghost Code Injection to make the font the same size as the content text.

<style>
  blockquote {
    font-size: 18px;
    line-height: 28px;
    box-shadow: 0 0 black;
    border-top: 0;
    border-left: 2px solid var(--ghost-accent-color);
    padding: 0;
    padding-left: 16px;
  }
</style>

The code will also remove the top and bottom border. Instead, it will add a left border.

The blockquote new style will be:

Krabi Ghost Theme Blockquote Style

Feel free to change the code to match your style.


Homepage Two Column Posts

To convert the homepage to two columns posts layout, use the following CSS code in Ghost Code Injection Site Header section.

<style>
  @media (min-width: 40em) {
    .js-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      grid-column-gap: 40px;
    }

    .c-post-card__content {
      display: flex;
      flex-direction: column;
    }

    .c-post-card__title {
      font-size: 20px;
      line-height: 24px;
    }

    .c-post-card__excerpt {
      margin-bottom: 16px;
    }

    .c-post-card__meta {
      margin-top: auto;
    }
  }
</style>

The result will be.

Krabi Ghost Theme BHomepage Two Column Posts

This will be applied only to medium and large screens, but the mobile layout will be the same. The layout is not recommended for small screens due to the limited space.

If you want to apply this to mobile too, you can remove the second line starting with @media and the line before the end, the }.


Changing Theme Typeface

Krabi is using one font, Inter.

The theme loads Inter using Google Fonts in the theme partials/fonts.hbs file. It is then assigned it to the body element along with other system fonts as a backup as the following example.

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
}

To change to any other font, you need to include the font on your theme or using Code Injection Site Header if you are using Google Fonts, for example.

For example, if you want to use the Roboto font from Google Fonts. Your code in Code Injection might be like this.

<link href='https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap' rel='stylesheet'>

<style>
  body {
    font-family: 'Roboto', sans-serif;
  }
</style>

You need to change that to the buttons and input elements.

<style>
  .c-btn,
  input {
    font-family: 'Roboto', sans-serif;
  }
</style>

You might find the following posts useful as well:

Loading Custom Typeface

I assume you have the font files and the initial @font-face CSS code for loading the font. Something similar to the following code.

@font-face {
  font-family: 'Atyp';
  src: local('Atyp Text Regular'), local('Atyp-Text-Regular'),
    url('AtypText-Regular.woff2') format('woff2'),
    url('AtypText-Regular.woff') format('woff'),
    url('AtypText-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
}

Create a new folder in the theme under /assets and name it fonts, for example, then copy your font files there.

Once you finish, zip the theme files, and upload the final zip file to your Ghost website.

In Ghost admin Code Injection, add your @font-face code with the new font files path wrapped in the <style> element.

<style>
  @font-face {
    font-family: 'Atyp';
    src: local('/assets/fonts/Atyp Text Regular'), local('Atyp-Text-Regular'),
        url('/assets/fonts/AtypText-Regular.woff2') format('woff2'),
        url('/assets/fonts/AtypText-Regular.woff') format('woff'),
        url('/assets/fonts/AtypText-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
  }
</style>

This should load the fonts. Then you can use the font and do your styling for the body and so on.


You can update the footer copyright line information from the theme partials/footer.hbs file. Open and edit that file using a code editor.


AMP

Read more about AMP at Google AMP + Ghost

The theme didn’t have an AMP file; the Ghost default/core one will be in use instead. If you want to customize it, you can add the default Ghost template to the theme folder and customize it.


Theme Development

This section is for developers only, and I assume you know what you are doing.

If you need to add custom CSS code, I highly recommend using Code Injection to avoid redoing your customizations with future theme updates.

Changing any .hbs file, for example, post.hbs, does not require being in development mode with gulp running. Just edit the file in your preferred editor and upload it.

If you are a developer and need to do heavy customization work, the theme uses Gulp to compile Sass and JavaScript. This improves the development flow and makes it much faster.

First, make sure you have Node.js, npm, Gulp CLI, and Bower installed. Check My Current Setup.

Run the following command in the theme root directory to install npm and bower dependencies.

npm install

To start Gulp, run:

gulp

This will compile Sass and JavaScript files and start watching changes as you edit files.

Gulp will produce two files:

assets/js/app.min.js: The final main JavaScript file.

This file is generated from many other JavaScript files listed in the gulpfile.js file. Gulp will do all the work to create that file, so no manual work is needed.

Gulp will watch your changes in the assets/js/app.js or assets/js/ghosthunter.js (if exist) and will then generate the final app.min.js file.

partials/compiled/inline-css.hbs: The final CSS file. It is used as an Internal CSS in the theme partials/head.hbs.

This file is generated from the assets/css/style-min.css file, which was generated by Gulp.

If you are working with Gulp, you should avoid editing these files. Instead, do customizations in assets/sass for CSS or in assets/js/app.js JavaScript. This way, you can ensure the flow is going in the right direction and never lose any changes.


My Current Setup

In case you are wondering what my current environment setup is and which package versions I use, take a look at the following:

$ node -v
v14.17.0

$ npm -v
7.16.0

$ bower -v
1.8.12

$ gulp -v
CLI version: 2.3.0
Local version: 4.0.2

This environment works well for running Ghost and also for theme development.

I use macOS Monterey / M1 Chip.

You don’t have to have the exact environment setup, so that’s fine if your current setup works.


Zip Theme Files

Use one of the following three options to create a zip file ready to upload to your Ghost website.

➊ Using your computer program

You can compress it as a standard folder like any other folder on your computer. If you are on Mac, right-click on the theme folder to view the context menu. Then, click the Compress option.

Ghost theme zip on macOS

➋ Using the command line

zip -r krabi.zip krabi -x '*.git*' '*node_modules*' '*bower_components*'

This command will exclude the node_modules and bower_components in case you are running gulp. And in case you are using Git, it will remove the .git folder.

➌ Using Gulp

Use the gulp zip command if you are running gulp.


Theme Update

You may be wondering how I can update my theme to the latest version?

There are two choices:

  • Keep your current theme and replace only the changed files from the new version. You can find the modified files on the theme page Changelog
  • Use the latest version as a starting point and redo your theme changes and customizations

One way to reduce the need for redoing customizations is to use the Code Injection tool. This is very helpful for adding custom CSS and tracking code. Keeping your custom CSS code with Code Injection is always recommended.


Support

Have any questions? I’m here to help.

Contact Ahmad
Ahmad Ajmi