Tutorial

Auto-Translate Ghost Blog Posts to 8 Languages with SiteLocaleAI

Published May 24, 2026

Auto-Translate Ghost Blog Posts to 8 Languages with SiteLocaleAI

Auto‑Translate Ghost Blog Posts to 8 Languages with SiteLocaleAI

Published on 2026‑05‑24


Overview

Ghost is a popular headless CMS for publishing blogs, but its out‑of‑the‑box SEO is limited to a single language. SiteLocaleAI solves this by providing a drop‑in JavaScript library that works with any framework, lets you run translations on your own LLM API keys, and offers a CLI to pre‑render fully translated pages for search engines. In this guide we’ll:

  1. Install SiteLocaleAI in a Ghost installation.
  2. Configure the library to translate every new post into eight target languages.
  3. Use the CLI to generate SEO‑friendly static snapshots.
  4. Verify that search engines index the multilingual pages.

The result is a set of locale‑specific URLs (e.g., /es/, /fr/, /ja/) that are instantly crawlable and rank for local queries.


Prerequisites

  • Ghost 5.x running on a Node.js server (self‑hosted or on a platform like Render).
  • An LLM API key (Claude, GPT‑4o‑mini, etc.) that you’ll pass to SiteLocaleAI.
  • Basic knowledge of Ghost’s routes.yaml and package.json.
  • Optional: Docker for isolated builds, but not required.

Step 1: Install SiteLocaleAI

Navigate to your Ghost root folder and install the library via npm:

npm install @sitelocaleai/translate

SiteLocaleAI is framework‑agnostic, so you can import it directly in your theme’s default.hbs (or any custom template). Add the following script tag before the closing </body> tag:

<script type="module">
  import { initLocaleAI } from '@sitelocaleai/translate';

  // Initialize with your LLM key and target locales
  initLocaleAI({
    apiKey: '<YOUR_LLM_API_KEY>',
    locales: ['es', 'fr', 'de', 'it', 'pt', 'ja', 'zh', 'ru'],
    rounding: true, // enable psychological price rounding
    defaultLocale: 'en'
  });
</script>

Tip: Store the API key in an environment variable (process.env.LLM_API_KEY) and inject it at build time to keep it out of the source repo.


Step 2: Configure LLM API Keys

Create a .env file (if you haven’t already) and add:

LLM_API_KEY=sk-xxxxxxxxxxxxxxxxxxxx

In config.production.json (or config.development.json) reference the variable:

{
  "site": {
    "url": "https://yourblog.com"
  },
  "env": {
    "LLM_API_KEY": "process.env.LLM_API_KEY"
  }
}

SiteLocaleAI will use this key for on‑the‑fly translation when a visitor requests a non‑default locale.


Step 3: Set Up Multilingual Routes

Ghost uses a routes.yaml file to define custom URLs. Add a locale prefix for each language:

routes:
  /:
    controller: channel
    filter: tag:hash-news
    template: index

  /{lang}/{slug}/:
    controller: entry
    filter: slug:{slug}
    template: post
    data:
      lang: '{lang}'

collections:
  /news/:
    permalink: /{slug}/
    filter: tag:hash-news
    template: index

The {lang} placeholder will be captured by SiteLocaleAI’s router and trigger the translation layer. Ensure the default language (en) is also covered:

  /{slug}/:
    controller: entry
    filter: slug:{slug}
    template: post

Step 4: Pre‑Render SEO Pages with the CLI

SiteLocaleAI ships a CLI tool that can pre‑render each locale to a static HTML file. This is crucial because search engine crawlers often don’t execute JavaScript. Install the CLI globally:

npm install -g @sitelocaleai/cli

Run the pre‑render command for your Ghost site:

sitelocale-cli render \
  --site https://yourblog.com \
  --locales es,fr,de,it,pt,ja,zh,ru \
  --output ./static-seo

The CLI performs the following steps:
1. Fetches every published post via Ghost’s Content API.
2. Sends the raw HTML to the LLM for translation.
3. Applies psychological price rounding (e.g., $9.99 → €8.99) per currency.
4. Writes locale‑specific HTML files to ./static-seo.

You can now serve the static-seo folder with a lightweight static server (e.g., serve -s static-seo) or configure your CDN to serve those files for bots using a User‑Agent rule.


Step 5: Verify Indexing

After deploying the pre‑rendered pages, use Google Search Console’s URL Inspection tool to fetch each locale URL (e.g., https://yourblog.com/es/hello-world/). The tool should show a “Submitted URL is indexed” status.

You can also run a quick curl check:

curl -I https://yourblog.com/ja/hello-world/ | grep "<meta name=\"description\""

The <meta> tags should contain the translated description generated by SiteLocaleAI.


Tips for Better SEO

  • Canonical Tags: In each translated page, set <link rel="canonical" href="https://yourblog.com/hello-world/" /> so Google knows the original content.
  • Hreflang Headers: SiteLocaleAI automatically injects <link rel="alternate" hreflang="es" href="https://yourblog.com/es/hello-world/" /> for all locales.
  • Sitemaps: Regenerate your sitemap after each new post and include every locale URL. Ghost’s sitemap.xml can be extended via a custom route.
  • Structured Data: Wrap your article content in JSON‑LD Article schema; the CLI will translate the headline and description fields automatically.

For a deeper dive, see the official docs:
- https://sitelocaleai.com/docs/quick-start
- https://sitelocaleai.com/docs/cli


Conclusion

By combining Ghost’s flexible routing with SiteLocaleAI’s self‑hosted translation library and SEO‑pre‑render CLI, you can automatically generate eight fully indexed language versions for every blog post. This boosts international traffic, improves conversion rates, and keeps you in control of LLM costs because you supply your own API keys.

Ready to go global? Try SiteLocaleAI today and watch your Ghost blog climb the rankings in every market.