Skip to content

Petra Ghost Theme Documentation

Theme version: 1.0.4 Changelog

Table of Contents


Install the theme

  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 Site > Theme.
  4. Click Change theme.
  5. Click Upload theme.
  6. Select the petra.zip theme file.
  7. When the upload finishes, click Activate theme. Some Ghost versions label this button Activate.

Upload routes.yaml (⚑ Required)

The routes.yaml file sets up the homepage and Blog page.

Before you upload

Uploading this file replaces your site’s current routes. In Routes, open the … menu and select Download file to save your current file first. Older Ghost versions show a download button directly. If you have custom routes, preserve them in the new file before uploading. Contact Aspire Themes if you need help combining the files.

  1. Unzip the petra.zip theme file.
  2. In Ghost Admin, go to Settings → Advanced → Labs.
  3. Select Open.
  4. Select Beta features.
  5. In Routes, open the … menu and select Upload file. If your Ghost version shows Upload routes file directly, select that button instead.
  6. Select and upload the routes.yaml file from the extracted theme folder.
Upload a routes file in Ghost

Homepage

The homepage will show a list of content sections.

Homepage Content

Petra Ghost Theme Custom Homepage Setting

➀ In Ghost admin, create a new Page.

➁ In Page settings, set the Page URL as home.

Petra Ghost Theme Custom Homepage Setting

➂ Add your content and excerpt, and upload your feature image.

Above the title in the Ghost editor, click the + Add feature image to upload your image.

Petra Ghost Theme Custom Homepage feature Image

➃ Click Publish.

Now, go to your website homepage; your content is visible.

Homepage metadata

Ghost uses your publication settings for the custom homepage. These set its title, description, and preview image.

  • Set the Title & description in Settings → General.
  • Set the Publication cover in Settings → Site → Design & branding → Customize → Brand. You can use the same image as the homepage feature image.

Search engines and social platforms can use these values when they show a link to your homepage.


Open Settings → General to set a different preview for each platform. Use the Twitter card and Facebook card fields. Each can have its own title, description, and image.


Social platforms cache link previews. A changed image or description may take time to appear.


Homepage Highlight Boxes

Petra Ghost Theme Homepage Highlight Boxes

Think of the Highlight Boxes section as a wall where you can add links to your important pages, whether on your website or other websites. For example, you can add a link to your online course, shop, podcast, or book. You get the idea.

The Highlight Boxes section is invisible by default. To show it:

  1. Go to your Ghost admin Settings → Site → Design & branding → Customize → Theme → Homepage.
  2. Activate the Show highlights section option.
Petra Ghost Theme Homepage Highlight Boxes Setting

Update the Highlight Boxes

Unzip the petra.zip file — the one you uploaded to your website — on your computer.

Petra Ghost Theme Homepage Highlight Theme Unzip

Open the petra folder using a code editor and open the theme /partials/home/highlights.hbs file. You can find four default boxes.

Petra Ghost Theme Homepage Highlight Theme File In Editor

Each Highlight box contains:

  1. Highlight link
  2. Highlight icon
  3. Highlight title
  4. Highlight description
<a href='#' class='c-card-highlight'>
  <div class='c-card-highlight__head'>
    <span class='c-card-highlight__icon'>❖</span>
    <h3 class='c-card-highlight__title'>Consulting</h3>
  </div>
  <p class='c-card-highlight__description'>Would love working together? Let’s do that.</p>
</a>

Let’s update the example with new data. We’ll make a box to link to a Goodreads profile:

  1. Replace the link href # value in the first line with my page URL
  2. Add a custom icon — see the icon example below or you can also use an emoji
  3. Instead of Consulting, let’s use Books
  4. And replace the description

The previous example might look like this:

<a href='https://www.goodreads.com/user/show/5387651-ahmad' class='c-card-highlight'>
  <div class='c-card-highlight__head'>
    <span class='c-card-highlight__icon'>❖</span>
    <h3 class='c-card-highlight__title'>Reading</h3>
  </div>
  <p class='c-card-highlight__description'>Check out my Goodreads profile and reading list.</p>
</a>

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

Dingbat ❊

✁ ✂ ✃ ✄ ✅ ✆ ✇ ✈ ✉ ☛ ☞ ✌ ✍ ✎ ✏ ✐ ✑ ✒ ✓ ✔ ✕ ✖ ✗ ✘ ✙ ✚ ✛ ✜ ✝ ✞ ✟ ✠ ✡ ✢ ✣ ✤ ✥ ✦ ✧ ★ ✩ ✪ ✫ ✬ ✭ ✮ ✯ ✰ ✱ ✲ ✳ ✴ ✵ ✶ ✷ ✸ ✹ ✺ ✻ ✼ ✽ ✾ ✿ ❀ ❁ ❂ ❃ ❄ ❅ ❆ ❇ ❈ ❉ ❊ ❋ ● ❍ ■ ❏ ☺ ☻ ♥ ♦ ♣ ♠ • ◘ ○ ❐ ❑ ❒ ▲ ▼ ◆ ❖ ◗ ❘ ❙ ❚ ❛ ❜ ❝ ❞ → ☀ ↳ ⤷ ✌︎ ☼ 

➀ ➁ ➂ ➃ ➄ ➅ ➆ ➇ ➈ ➉

➊ ➋ ➌ ➍ ➎ ➏ ➐ ➑ ➒ ➓

Fleuron ❦

❦ ❧ ☙


To control how many featured or recent posts to show, go to your Ghost admin Settings → Site → Design & branding → Customize → Theme → Homepage.

You will find two input settings:

  • Number of featured posts default value is 2, which shows two featured posts.
  • Number of recent posts default value is 6, which shows six recent posts, excluding featured posts.

Input values you can use:

  1. Number, 1, 2 or 3 or any number you want to include
  2. all to show posts up to Ghost’s query limit (normally 100)
  3. none to show nothing
Homepage Number of Featured and Recent Posts Settings

Tags Page

The Tags page will automatically pull your website tags. Max 100 tags will be shown.

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. Click Publish to 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.


Changing Colors

You can change all your website colors from the admin settings.

Go to your website admin Settings → Site → Design & branding → Customize → Theme → Site wide to show color settings.

Petra Ghost CMS Theme Colors Settings

Colors Explained

  1. Text color primary. Main text color for site content.
  2. Text color secondary. Text color for post date and image caption elements.
  3. Border color. Color of the border, for example, the border around post cards.
  4. Background color primary. The main background color.
  5. Background color secondary. For site footer, post card hover background, Homepage Highlight Boxes hover background, and a placeholder for images before loading.

You can also set the Accent color from the admin Settings → Site → Design & branding → Customize → Brand → Accent color. The Accent color is used for the content Header Card with the background set to the Accent color and also for the Homepage Highlight Boxes.

Ghost Accent Color Setting

Color Tools

The following are some online websites and tools to help with color inspiration. Please make sure you choose an accessible color scheme; this is important for readers.


Membership

Petra has different interface elements for membership features.

  1. Homepage top subscribe form in the introduction section.
  2. Global subscribe form at the end of every page.
  3. 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.

Turn off membership

To remove sign-in and signup links and forms, turn off membership access in Ghost Admin.

  1. Go to Settings → Membership → Access.
  2. Select Nobody.
  3. Click Save.

Remove homepage top subscribe form

Add the following CSS in the Ghost admin Code Injection Site Header.

<style>
  .c-content--home .c-subscribe { display: none; }
</style>

Remove the global subscribe form

Add the following CSS in the Ghost admin Code Injection Site Header.

<style>
  .c-section--newsletter { display: none; }
</style>

Hide the Portal button

The floating Portal button is separate from your site’s membership links. Open Settings → Membership → Signup portal → Customize, then turn off Show portal button under Look & feel. Portal links still work when the button is hidden. See Ghost’s Portal settings.

Ghost Admin setting for hiding the Portal button

Membership Troubleshooting Tips

If the subscribe form shows an error, check these items first:

  1. Make sure your site is running the latest version of Ghost.

  2. If you self-host Ghost, configure the mail settings and restart your server.

  3. Check that Ghost’s configured URL matches your public site address. See the Ghost URL documentation.

Use the full public URL. If your site uses a subpath, enter the full path, such as https://example.com/blog/. If SSL is enabled, use https://.


If the issue continues on Ghost(Pro), contact Ghost support. If you self-host, contact your hosting provider.


Membership email delivery and server configuration are handled by Ghost or your host, not by the theme.

See the official Ghost membership guide for member setup, Stripe connections, and subscription prices.


Post Feature Image Size

The ideal feature image size is 1054 × 702. The visible size is 527 × 351; double it to 1054 × 702 for sharper results on retina displays.

Upload the feature image from the post editor (above the title). It appears in homepage listing cards but is not displayed on the individual post page; you may still insert it as the first image within the post content if desired.

Petra Post Feature Image

You can add, edit, delete, and reorder the navigation menu in Ghost admin at Settings → Site → Navigation.

Ghost CMS navigation menu

Add New Page to Navigation

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

Ghost CMS label field

Next, click the item’s URL. The base URL will already be auto-populated. Add the page slug after the final /, then click Save.

Add Blog Page to Navigation

To add the blog item to the site navigation, add it as a navigation item. Set the destination URL to /blog/, as shown below.

Petra Ghost Theme Blog Navigation Item

Add a Hyphen (-) followed by a space before the navigation Label to add a dropdown menu.

Ghost dropdown navigation menu

In this example, Contact will be the parent item with Blog and Archive as child items.

Add footer links under Settings → Site → Navigation → Customize → Secondary. Publishing a page does not add it to this menu automatically.


Petra uses the Ghost Native Search.

Ghost search uses post titles and excerpts from the 10,000 most recent posts. It does not search the full body of every post.

To remove search:

  1. Go to your Ghost admin Settings → Site → Design & branding → Customize → Theme → Site wide
  2. Toggle the Enable search option off
  3. Click Save

Comments

The theme comes with Ghost Native Comments integration. You can turn the comments on from your Ghost admin Settings → Membership → Access.

Learn more about Ghost comments.


The theme displays the Facebook and Twitter accounts set in Ghost Admin. Go to Settings → General → Social accounts and add your URLs.

By default, Ghost fills these fields with Ghost social links. If you don’t have Twitter and Facebook, remove the defaults and the links will disappear from the theme.

Ghost CMS Theme Social Accounts

Petra supports adding Instagram, Pinterest, YouTube, and LinkedIn URLs. Go to Settings → Site → Design & branding → Customize → Theme → Site wide.

Petra Ghost Theme Social Media Accounts Settings

The social links theme file is at /partials/social-links.hbs.


Languages

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

Theme Translation

Petra 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 your Ghost admin Settings → General → Publication language and enter the ISO Code into the Publication Language field.

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

  • ar for Arabic
  • da for Danish
  • de for German
  • 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 these 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. For example, if the new language is Japanese, the ISO code will be ja and 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.

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

Now, go to your Ghost admin Settings → General → Publication language and enter your language ISO code into the Publication Language field. For example, ja.

Click Save settings.

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

Edit Translation

To edit an included translation, open its file in the theme’s /locales/ folder with a code editor:

|____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) looks like this:

{
  "Skip to content": "Zum Inhalt springen",

  "Page Not Found": "Page Not Found",

  "Featured Posts": "Featured Posts",
  "Recent Posts": "Recent Posts",
  "Next": "Next",

  "Comments": "Kommentare",

  "1 min": "1 minuten",
  "% min": "% minuten",

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

  "Subscribe": "Abonnieren",
  "Email address": "Email address",
  "Subscribe to receive the latest posts in your inbox.": "Abonnieren Sie, um die neuesten Beiträge in Ihrem Posteingang zu erhalten.",
  "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.",

  "This content is for Members": "Dieser Inhalt ist für Mitglieder",
  "This content is for Paid Members": "Dieser Inhalt ist für bezahlte Mitglieder",
  "This content is for Subscribers on the ": "This content is for Subscribers on the ",
  "Upgrade your account": "Aktualisieren Sie Ihr Konto",
  "Already have an account?": "Hast du schon ein Konto?",

  "Published with {ghostLink} & {themeLink}": "Veröffentlicht mit {ghostLink} & {themeLink}"
}

Each line consists of a left key ("Loading") and a right value ("Wird geladen").

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.

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 RTL:

  1. Go to Settings → Site → Theme.
  2. Open the … menu beside your active theme and select Edit code.
  3. Open partials/structure/head.hbs and replace {{> css/dist/style }} with {{> css/dist/style-rtl }}.
  4. Click Save, then Replace theme to apply the change.

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

Multiple Languages Support

The theme uses Ghost translations for its interface. Set the site language to French to show labels, such as button text, in French.

Ghost does not support several site languages out of the box. The theme does not add this feature.


Posts Per Page

The theme displays 15 posts per page by default. To change this in Ghost Admin:

  1. Go to Settings → Site → Theme.
  2. Open the … menu next to your active theme and select Edit code.
  3. Open package.json and find posts_per_page inside config.
  4. Replace 15 with the number of posts you want per page.
  5. Click Save, then Replace theme to apply the change.
"config": {
  "posts_per_page": 15
}

Typography Drop Caps

The theme comes with different styles of typography drop caps. A drop cap applies to the first letter of the first word in a 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>. See below for the available classes for each style.
  3. Add your paragraph text within that <p></p> HTML element.
Petra Ghost Theme Typography Dropcap HTML Card

There are currently two styles available.

➊ Small Drop Cap

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

Result:

Petra Ghost Theme Typography Dropcap

➋ Large Drop Cap

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

Result:

Petra Ghost Theme Typography Dropcap Large

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

Changing Theme Typeface

Petra is using one typeface, DM Sans.

The theme loads DM Sans using Google Fonts in partials/typography.hbs. It is then assigned as a CSS variable with system fonts as backups, as follows:

:root {
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
}

To change the typeface to any from Google Fonts, use Code Injection Site Header.

If you selected fonts in Ghost, set the body and heading fonts to Theme default first. Ghost’s font choices take precedence over this example.

For example, to use the Roboto typeface from Google Fonts, your Code Injection might look like this:

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

<style>
  :root {
    --font-body: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  }
</style>

If you have a custom typeface, check out the Loading Custom Typeface section below.

You might find the following posts helpful 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 the Ghost admin Code Injection Site Header, add your @font-face code with the new font files path wrapped in the <style> element.

<style>
  @font-face {
    font-family: 'Atyp';
    src: local('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.


RSS Feed URL

RSS is a way for people to receive updates from your website by adding your website’s RSS link to their RSS application (Feedly for example). Once you publish content, they will receive a notification.

If your website is private, the RSS URL will not function properly. Once your website is made public, the URL will work as expected.

Since Petra uses the /blog/ URL for posts, you can access the RSS feed at site.com/blog/rss/ instead of site.com/rss/. For example, petra.aspirethemes.com/blog/rss/.


Publication icon

You can change the favicon from the Ghost admin Settings → Site → Design & branding → Customize → Brand → Publication icon.


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:

Petra 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:

Petra Ghost Theme Syntax Highlighting with prismjs

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

Prism

The theme uses Prism.js to highlight code blocks.

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

You can add support for more languages by adding the Prism autoloader script, which will automatically load the languages you need. To do this, add the following script to the website admin Code Injection (Site Footer).

<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.28.0/plugins/autoloader/prism-autoloader.min.js" integrity="sha512-fTl/qcO1VgvKtOMApX2PdZzkziyr2stM65GYPLGuYMnuMm1z2JLJG6XVU7C/mR+E7xBUqCivykuhlzfqxXBXbg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>

Click Save.


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 is in Markdown, this will work fine for you.

To create a footnote, check out the Markdown Guide – Footnotes for more information about the syntax. You can see how the theme renders footnotes in the demo. In the editor, add a new Markdown card and place your footnote inside it.

The theme renders whatever the editor supports; there is no additional footnote support beyond what Ghost provides.

Check out this Forum discussion for more information and probably some ideas and workarounds.

The theme does not add any footnotes functionality beyond Ghost’s Markdown implementation.


Theme Deploy with GitHub Actions

Petra 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.

Petra ghost theme — 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 maintained by Ghost and works with any Ghost install, whether you self-host Ghost or use Ghost Pro.


Code injection

You can also customize the theme through Code injection in Ghost Admin.

  1. Open Settings → Advanced → Code injection.
  2. Select Open.
  3. Choose Site header or Site footer, as directed by the example.

Paste this CSS into Code Injection → Site header to change the logo color and font size.

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

Select Save to apply the code.

The video shows how Ghost Code Injection works and how to use it.

Check out How to use Code Injection Ghost guide for more information.


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: 40px; }
</style>

The default value is 40px, 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 before uploading for better results.


To change the footer copyright text:

  1. Go to Settings → Site → Theme.
  2. Open the … menu beside your active theme and select Edit code.
  3. Open partials/structure/footer.hbs and edit the copyright text.
  4. Click Save, then Replace theme.

If you just want to remove the Published with Ghost… part, copy and paste the following code into the Ghost admin Code Injection Site Footer.

<script>
  var footer_copy = document.querySelector('.c-footer-copy'),
  footer_copy_visible_part = footer_copy.innerText.split('-')[0];
  footer_copy.innerText = footer_copy_visible_part;
</script>

Zip Theme Files

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

Have any questions? Contact Ahmad

Theme Editing & Tools

Edit the theme files mentioned here with a code editor. I recommend Visual Studio Code or Sublime Text. 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're looking for Ghost hosting, I recommend Ghost(Pro).