Tutorial

Auto-translate Ghost Posts to 8 Languages for SEO

Published May 5, 2026

Auto-translate Ghost Posts to 8 Languages for SEO

Auto‑translate Ghost Posts to 8 Languages for SEO

Published on 2026‑05‑05

Ghost is a fast, headless publishing platform that works great with static site generators and modern front‑ends. However, reaching a global audience usually means manually translating each article, creating separate language‑specific routes, and worrying about duplicate content. SiteLocaleAI solves all of that with a drop‑in JavaScript library, a CLI for SEO pre‑rendering, and price localization that respects psychological rounding per currency.

In this tutorial we’ll:
1. Install SiteLocaleAI in a Ghost theme.
2. Configure the library to translate every new post into eight languages.
3. Use the CLI to generate SEO‑friendly static snapshots for search engines.
4. (Optional) Hook the WordPress plugin for cross‑platform publishing.

Prerequisites
- A Ghost installation (self‑hosted or Ghost(Pro)).
- Access to an LLM API key (Claude, GPT‑4o‑mini, etc.).
- Node.js ≥ 16 for the CLI.


1. Add SiteLocaleAI to Your Ghost Theme

SiteLocaleAI works with any front‑end framework because it’s just a plain <script> tag. Open your theme’s default.hbs (or the equivalent layout file) and insert the following before the closing </body> tag:

<!-- SiteLocaleAI – multilingual and price localization -->
<script src="https://cdn.sitelocaleai.com/v1/site-locale.min.js"></script>
<script>
  // Initialise the library with your LLM API key and target languages
  SiteLocaleAI.init({
    apiKey: "YOUR_LLM_API_KEY",
    languages: ["en", "es", "fr", "de", "it", "pt", "ja", "zh"],
    // Enable price rounding per currency (e.g., $9.99 → $10)
    priceLocalization: {
      enabled: true,
      rounding: "psychological"
    },
    // Optional: custom domain mapping for SEO‑friendly URLs
    urlMap: (lang, slug) => `/${lang}/${slug}`
  });
</script>

Tip: Keep the apiKey on the server side and expose it to the front‑end via a secure environment variable or a short‑lived token. SiteLocaleAI never stores the key.

Now every page that renders {{content}} will be automatically translated on the client side. But search engines can’t execute JavaScript reliably, so we need the CLI to pre‑render the translations.


2. Install the SiteLocaleAI CLI

npm install -g @sitelocaleai/cli

The CLI reads your Ghost RSS feed, fetches each post, sends it to the LLM for translation, and writes static HTML files that can be served to crawlers.

Create a configuration file site-locale.config.json in the root of your Ghost project:

{
  "apiKey": "YOUR_LLM_API_KEY",
  "sourceLang": "en",
  "targetLangs": ["es", "fr", "de", "it", "pt", "ja", "zh"],
  "outputDir": "public/seo",
  "priceRounding": "psychological",
  "ghostUrl": "https://your-ghost-site.com",
  "rssPath": "/rss/"
}

Run the pre‑render step:

site-locale render --config site-locale.config.json

The CLI will:
- Pull the latest 20 posts from the RSS feed.
- Translate the title, excerpt, and body into each target language.
- Apply price rounding based on the visitor’s currency.
- Generate a static HTML file for every language version under public/seo/<lang>/<slug>.html.

You can now point your web server (or a CDN) to serve the public/seo folder for bots. Ghost will continue to serve the dynamic, client‑side version for regular visitors.


3. SEO‑Friendly URLs & Canonical Tags

Search engines love clean, language‑specific URLs. In your Ghost theme, add a canonical link that points to the language‑specific static file when a crawler requests it. Detect crawlers via the User‑Agent header (or use a reverse‑proxy rule) and serve the pre‑rendered HTML.

{{#if isCrawler}}
  <link rel="canonical" href="{{siteUrl}}/{{lang}}/{{slug}}/" />
{{else}}
  <link rel="canonical" href="{{url}}" />
{{/if}}

Make sure the lang variable matches the language code used in the CLI output. This prevents duplicate‑content penalties and tells Google which version to index.


4. Optional: WordPress Plugin for Cross‑Platform Publishing

If you also run a WordPress site, SiteLocaleAI offers a Node‑free plugin that pulls content from Ghost via the RSS feed and applies the same translation pipeline. Install it from the WordPress dashboard, paste the same apiKey, and enable the eight languages. The plugin will create a page for each language automatically, keeping your SEO consistent across platforms.

For more details, see the official docs: https://sitelocaleai.com/docs/wordpress-plugin


5. Verify Indexing

After deploying the static files, use Google Search Console’s URL Inspection tool on a few language URLs, e.g., https://your-site.com/es/your-post-slug/. You should see a fully rendered HTML snapshot with the translated content and proper <title>/<meta description> tags.

If you notice missing translations, double‑check:
- The targetLangs array in the config file.
- That the LLM API key has enough quota.
- That the priceRounding option is set to psychological.


6. Wrap‑Up & Next Steps

You now have a self‑hosted, LLM‑powered multilingual pipeline for Ghost:
- Zero‑code translation for visitors via the JS library.
- SEO‑ready static snapshots for crawlers via the CLI.
- Price localization that respects local buying psychology.
- Framework‑agnostic – works with any Ghost theme, React, Vue, or even plain HTML.

Ready to boost your international traffic? Try SiteLocaleAI today and see how easy it is to go global.


Start your free trial →


For deeper technical reference, visit our documentation:
- https://sitelocaleai.com/docs/cli
- https://sitelocaleai.com/docs/js-library