Basic tips for setting up a self-hosted Ghost blog

I’ve been running my blog on the Ghost content management system (CMS) since last fall. Positive aspects of it so far over my old CMS, WordPress/ClassicPress, include:

  • A bigger focus on writing, versus web page publication/design.
  • Less maintenance (no multiple plugins to worry about, etc.).
  • The use of Markdown.
  • SEO and other popular aspects are already built into Ghost by default, rather than relying on plugins.

That said, Ghost does come with its own things to watch out for, and since it’s still not as widely used as WordPress, advice might be harder to come by. Thus, I thought I’d write this post summing up my basic Ghost advice, using my own experience and various online resources.

Installing Ghost

Ghost’s requirements (Node.js, etc.) means it’s not as widely supported by web hosts as WordPress. However, there’s some webhosts that make setting up a self-hosted Ghost blog fairly easy. DigitalOcean, the VPS host I use, offers a “one-click” setup install. (Instructions are available here, as well as in this YouTube instructional video.) DigitalOcean “droplets” start as low as $5/month.

Ghost also offers a “pro” hosted service on their site; however, it’s expensive, starting at $29/month.

Migrating from WordPress to Ghost

I described my own migration in a previous post, though Ghost also has instructions.

I first backed up the old WordPress posts, using the Ghost export plugin. I downloaded the offered JSON file; another option offered is a ZIP file that includes images, which is what most users should use. In my case, given my blog’s size, I worried using this feature might’ve resulted in too many WordPress timeout errors.

Instead, for the old site’s images, I used the Export Media Library plugin, which downloaded the images in a ZIP file. I then manually uploaded those to the new Ghost installation (using an FTP program). Given this plugin’s not been updated in almost a year, another alternative plugin may be used instead.

In either case, importing the old posts/images into Ghost consisted of going into the Ghost admin panel under Settings > Labs > Import content, and choosing the JSON/ZIP file to import. Note depending on the number of images, you may have to break those up into smaller separate ZIP files (no more than 50 MB each).

After installing Ghost

Ghost default setup
“Ghost Blogging Platform” by xmodulo is licensed under CC BY 2.0 (Flickr)

After installing Ghost and migrating old posts, I also performed some other activities to complete setting things up:

Ghost by default doesn’t include dates in its blog post URLs, unlike WordPress. Thus a choice needs to be made: either keep Ghost’s default and redirect the old URLs, or switch Ghost to using dates in URLs. I opted for the first one, since it made for shorter (and possibly less dated-looking) links.

To redirect old date-containing links, in the Ghost administration panel, go to Settings > Labs > Redirects, click “download current redirects,” and edit the file in a text editor as follows:

[{"from":"/([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)","to":"/$4","permanent":true},{"from":"/feed/","to":"/rss/","permanent":true}]

Afterwards, re-upload the edited file under the same settings. Restarting Ghost is also advised.

This should redirect, say, “yourdomain/2021/03/25/greatest-superman-stories” to “yourdomain/greatest-superman-stories.”

I also included a redirect for my site’s RSS feed, as Ghost uses feeds ending with “/rss/” instead of WordPress’ “/feed/”.

Scanning and fixing any broken links after moving a site is generally a good idea. While there’s not really a Ghost feature or plugin to do this, I’ve used the website Broken Link Checker to scan my blog. Its free version handles sites up to 3000 pages.

Finding a new theme

Finding a new blog theme’s never easy, and Ghost’s themes are fewer in number versus WordPress. However, Ghost does have its own selection of free and paid themes on its site.

Search page
My Ghost blog’s search page using Google Search. (Screenshot by author)

Ghost doesn’t include site search by default. While a few themes, such as Liebling, include search support, it’ll usually require manual setup. The simplest option is using Google Search; how I set it up on my site, using Ghost’s own instructions:

  1. Create a new Ghost page named “Search.”
  2. In the Search page, include an HTML block.
  3. Go to Google’s custom search page, and set up a search option, including any desired customizations (color scheme, etc.).
  4. Copy the search option’s HTML code into the Search page’s HTML block.

For those who prefer DuckDuckGo, they also offer a similar custom search option; follow the same instructions as above to include its code on your Search page.

Installing site analytics

After trying a few alternate options, I’ve gone back to using Google Analytics for site analytics. It was easier to set up than Matomo, which requires more technical skill to set up and run.

Ghost has straightforward instructions on including Google Analytics.

Setting up comments

Remarkbox comments
My Ghost blog using Remarkbox comments. (Screenshot by author)

Unlike WordPress, Ghost doesn’t include comments by default. Those wanting comments will need a third party solution; however, all of them require one of the following:

  • Self-hosting, which requires technical skills to set up and maintain.
  • A paid option; most of these aren’t cheap.
  • An ad-supported free option, which come with some issues.

The most popular free option is Disqus. While Disqus is popular, I ran into issues on my site trying to incorporate Disqus comments. Since Disqus is ad supported, there’s also some concerns about privacy and site loading speed. Still, for those interested, here’s Ghost’s instructions on installing Disqus (which differ slightly from the instructions Disqus’ site offers).

Another option I’ve been trying on my site (as of this writing) is Remarkbox. You can follow the same instructions for including Remarkbox’s code as for Disqus above. Most themes include a section for including comments code; in my current theme’s case (Alto), it’s in the “partials” section, as a file named “comment.hbs.”:

{{!-- <div class="comment-container">
    <div class="container">
        <div class="comment container medium">
            If you want to embed comments, this is a good place to do it!
        </div>
    </div>
</div> --}}

For those using the Alto theme, download and unzip a copy of the theme. Under comment.hbs, paste the Disqus/Remarkbox/etc. comments code in place of the “If you want to embed comments…” text. Then, delete the “{{!–” and “–}}” brackets to activate site comments. Finally, re-zip the theme and upload to your site through the Ghost admin panel (under Settings > Design).

Other themes will require investigating where the comments code should be inserted; for the default Casper theme, it’s in the post.hbs file.

“wocintech (microsoft) – 62” by wocintechchat.com is licensed under CC BY 2.0 (Flickr / cropped from original)

Leave a Reply

Your email address will not be published. Required fields are marked *