Back to Documentations

Tripoli Documentation

Theme version: 1.0.1 — 17 May 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 tripoli, you will find the tripoli.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 tripoli.zip theme file.
  5. Once uploaded, click Activate now to activate Tripoli.

Upload the routes.yaml File (⚑ Required)

The routes.yaml is required for the following reasons:

To upload the file, follow these steps:

  1. Unzip the tripoli.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.

Do this separately after uploading your theme zip file.


Homepage

The homepage will show a list of content sections.

Hero Section

The homepage hero section will include three columns. Two columns for featured posts and one for the latest posts.

The center and left columns will include the most recent three featured posts. To make a post as featured, you can do that from the post setting by checking the Feature this post checkbox.

The right column will include the most recent six posts. Clicking the Latest header will take you to the Latest page where you can see all the recent posts.

Tripoli Ghost Theme Custom Homepage Hero

Tags Sections

You can add many tags section to the homepage, each section will show the recent 4 posts by the tag. To set this up:

  1. Go to the Ghost admin Settings > Design > Site design > Homepage
  2. In the Tag slugs for home sections input, add all tge Tags Slug you want to include seperated by (,).
Ghost Theme Tag Setting

To get the Tag Slug, you can find it in each Tag page from the admin.

Ghost Theme Tag Setting

You might end up with the Slugs as:

politics,covid,technology,business,sport,life,history,food

The Editors’ Picks section will show 4 posts tagged with the hash-editors-picks tag.

  1. Go to your adming Tags page, click the top right Internal tags tab.
  2. Click the New tag button.
  3. In the name field, add #editors-picks
  4. Click Save
Ghost Theme Internal Tag Setting

Then, for each post you want to hilight here, select the #editors-picks fromt the post Tags setting.

Ghost Theme Internal Tag Setting

To enable search, you’ll need to create a new Content API Key. Follow these steps to create your Key.

In the left-side menu of your Ghost admin, click Integrations then + Add custom integration.

Add new Ghost Custom integrations

Give the new integration a name, like “Search”, and click Create.

Name for the Ghost Custom integrations

A new Content API Key will be created. When you hover over it, a Copy button will appear. Click the button to copy the key to the clipboard.

Copy Ghost Custom integrations Content API Key

Next, go to your website admin Settings > Design > Site design > Site-wide and paste the Content API Key into the Search content API key input field.

Tripoli Ghost CMS Theme Search Settings

Click Save. That’s it. The search will be visible and now working on the site header.


Dark Mode

The theme will adapt to the reader operating system mode. The dark mode option is enabled by default. You can also switch between dark and light modes from the header link.

The theme comes with three admin settings from which you can have more control over dark mode.

  1. Disable the dark mode entirely and only keep the website in light mode.
  2. Upload a logo to be visible when the dark mode is active.
  3. Add accent color. This accent color is for buttons and tags.

Go to your website admin Settings > Design > Site design > Site-wide to show dark mode settings.

Tripoli Ghost CMS Theme Dark Mode Settings

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, add it as a Navigation item with authors/ as the URL
Ghost Authors Page
Tripoli Ghost Theme Authors Page

Newsletters Page

The idea behind the Newsletters page is to enable your reader to subscribe to specific types of content.

The Newsletters page uses the Ghost Labels feature to create different labels, and when a user chooses a Label and subscribes to it, you will see the Labels in his admin profile.

Ghost Membership Profile

When you are about to send a newsletter email or publish a post, you can select which Labels you want to send the post to.

Ghost Post Publish Settings with Labels

Publish the Newsletters page:

  1. Create a new page and give it a title, like “Newsletters”
  2. From Page settings, select the Newsletters template
  3. Publish the page
  4. To add the page to the navigation, add it as a Navigation item with newsletters/ as the URL

Change the default Labels:

The theme comes with default Labels, and you will need to change them to match your preference. Open the theme /partials/newsletters-labels.hbs file using a code editor to change them, and you will also find the instructions in the same file.


Post Featured Image Size

The work featured image ideal size to upload is 1054 × 702. The visible size is 527 × 351, but double it to 1054 × 702 to look sharper on retina displays.


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

Ghost CMS navigation menu

Add New Page to Navigaiton

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

Ghost CMS label field

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

Click the Save button.

Add Authors Page to Navigaiton

To add the blog item to the site navigation, add it as a navigation item. Make sure to set the destination URL to /blog/ like the following screenshot.

Ubud Ghost Theme Blog Navigation Item

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


Ghost supports adding Facebook and Twitter URLs. Go to Settings > General > Social accounts and add your URLs from your site admin.

Ghost CMS Theme Social Accounts

Tripoli supports adding Instagram, YouTube, and Linkedin URLs. Go to Settings > Design > Site-wide.

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

{
  "Skip to content": "Skip to content",

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

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

  "Loading": "Loading",
  "Load More": "Load More",

  "Subscribe": "Subscribe",
  "Email address": "Email address",
  "Subscribe to receive the latest posts in your inbox.": "Subscribe to receive the latest posts in your inbox.",
  "Please check your inbox and click the link to confirm your subscription.": "Please check your inbox and click the link to confirm your subscription.",
  "Please enter a valid email address.": "Please enter a valid email address.",
  "An error occurred, please try again later.": "An error occurred, please try again later.",

  "This Content Is for Members": "This Content Is for Members",
  "This Content Is for Paid Members": "This Content Is for Paid Members",
  "Already have an account?": "Already have an account?",

  "Published with {ghostLink} & {themeLink}": "Published with {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.

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 7 to {{> css/dist/style-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 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 in 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.


Posts Per Page

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

"config": {
  "posts_per_page": 16
}

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


Typography Drop Caps

The theme comes with different styles of typography drop caps. It will apply to the first letter of the first word in 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
Tripoli Ghost Theme Typography Dropcap HTML Card

There are currently four styles available.

➊ Small Drop Cap

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

The result.

Tripoli Ghost Theme Typography Dropcap

➋ Large Drop Cap

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

The result.

Tripoli Ghost Theme Typography Dropcap Large

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


Changing Theme Typeface

Tripoli is using two typefaces:

  • Inter for the overall theme text such as navigation items, date, buttons, tags,…
  • Source Serif Pro for the post title and content.

The theme loads both typefaces using Google Fonts in the theme partials/typography.hbs file. It is then assigned as a CSS Variable and other system fonts as a backup in the theme /assets/sass/tokens/_typography.scss as the following example.

:root {
  --font-family-serif: 'Source Serif Pro', Georgia, serif;
  --font-family-sansSerif: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
}

You don’t need to edit the theme files if you want to use another typeface. Instead, use Code Injection Site Header.

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

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

<style>
  :root {
    --font-family-sansSerif: '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.


I assume that 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>

Then, you can assign the font to the theme CSS Variable as:

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

The above example will replace the Inter typeface with your one, which in this example Atyp.

If you are using another typeface to replace the theme Source Serif Pro, you can assign it to the --font-family-serif variable as:

<style>
  :root {
    --font-family-serif: 'MY_SERIF_FONT_NAME', Georgia, serif;
  }
</style>

With both new typefaces, the new CSS Variables will be like:

<style>
  :root {
    --font-family-serif: 'MY_SERIF_FONT_NAME', Georgia, serif;
    --font-family-sansSerif: 'Atyp', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  }
</style>

RSS Feed URL

Since Tripoli uses /latest/ URL for latest posts, you can access the RSS feed at site.com/latest/rss/ instead of site.com/rss/. For example, tripoli.aspirethemes.com/latest/rss/.

An RSS icon is on the theme footer.


Google Analytics

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


Update Favicon

You can change the favicon in Ghost from Admin > General > PUBLICATION IDENTITY > Publication icon.

Update Ghost CMS favicon

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, basically, 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

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

Tripoli documentation Ghost CMS Theme GitHub Actions

I have written about this at 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 developed by Ghost and works with any Ghost install whether you self-host Ghost or using 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.


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 for better results.


You can update the footer copyright line information from the theme partials/footer.hbs file.


AMP

The AMP integration in Ghost is enabled by default, but if you prefer not to use the feature then you can turn it off in the settings within Ghost Admin.

Read more about AMP at Google AMP + Ghost

The theme didn’t have an AMP file; the Ghost default/core one will be used 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/css/dist/style.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, it’s recommended you avoid editing these files. Instead, do customizations in assets/sass for CSS or in assets/js/app.js JavaScript. This way, you can make sure 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 set up 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 just like you do with 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 tripoli.zip tripoli -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 can I update my theme to the latest theme 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.


Your feedback is very welcome ♥

I’m open to your feedback and hear your experience about my themes and work. If you have a few minutes, please send your thoughts through this Google Form.

Thank you for your time!

Support

Have any questions? I’m here to help.

Contact Ahmad
Ahmad Ajmi