Translate WordPress Blog to Spanish with SEO‑Ready Pre‑Rendering
Target audience: WordPress site owners, developers, and marketers who want to reach Spanish‑speaking audiences while keeping their SEO intact.
1. Why a Self‑Hosted Solution?
Self‑hosting the translation engine gives you three major advantages:
- Data privacy – your content never leaves your server.
- Cost control – you only pay for the LLM API calls you actually make (Claude, GPT‑4o‑mini, etc.).
- Full SEO control – the CLI can pre‑render static HTML for each language, letting crawlers index the exact content they see.
SiteLocaleAI is framework‑agnostic, but the WordPress plugin makes integration a breeze—no Node.js required.
2. Prerequisites
- A WordPress installation (any version ≥ 5.9).
- An LLM API key (Claude, GPT‑4o‑mini, or any OpenAI‑compatible endpoint).
- Access to your server’s command line (SSH) for the SEO CLI.
- Optional: a staging environment to test before going live.
3. Install the SiteLocaleAI WordPress Plugin
- Download the plugin from the SiteLocaleAI marketplace or via the direct link:
https://sitelocaleai.com/plugin.zip. - In the WordPress admin, go to Plugins → Add New → Upload Plugin, select the zip file, and click Install Now.
- Activate the plugin.
The plugin automatically enqueues the SiteLocaleAI JavaScript library on every front‑end page. No additional build step is required.
4. Configure Your LLM API Key
Navigate to Settings → SiteLocaleAI in the WordPress dashboard:
API Provider: Claude / OpenAI / Custom
API Key: sk-xxxxxxxxxxxxxxxxxxxx
Target Language: Spanish (es)
Rounding: Psychological (e.g., $9.99 → €9.90)
Save the settings. The plugin now knows which model to call and how to format price localization.
5. Add the Translation Hook to Your Theme
If you want more control (e.g., only translate post content, not the header), edit your theme’s single.php or content.php and insert the following snippet before the closing </body> tag:
<script src="https://cdn.sitelocaleai.com/v1/site-locale.min.js"></script>
<script>
// Initialize the library with the API key stored in wp_options
const apiKey = '<?php echo get_option("sitelocaleai_api_key"); ?>';
const targetLang = 'es';
SiteLocale.init({
apiKey: apiKey,
language: targetLang,
// Enable price rounding per currency
priceRounding: true,
// Callback for debugging
onError: (err) => console.error('SiteLocale error:', err)
});
</script>
The library will automatically detect translatable text nodes, replace them with Spanish equivalents, and apply psychological rounding to any detected prices.
6. SEO‑Friendly Pre‑Rendering with the CLI
Search engines like Google and Bing cannot execute JavaScript for every request. To ensure your Spanish pages are indexed, use the SiteLocaleAI CLI to generate static HTML for each post.
6.1 Install the CLI (one‑time)
npm install -g @sitelocaleai/cli
If you prefer a Docker‑based approach, the docs provide a ready‑made image:
docker pull sitelocaleai/cli:latest
6.2 Run the Pre‑Render Command
From your WordPress root (where wp-config.php lives), execute:
sitelocale-cli pre-render \
--lang es \
--output ./public/es \
--api-key $SITELOCALEAI_API_KEY
The CLI crawls every public post, renders it through the LLM, and writes the resulting HTML to ./public/es. Each URL mirrors the original structure, prefixed with /es/ (e.g., example.com/es/mi-primer-post).
6.3 Serve the Pre‑Rendered Files
Add a simple rewrite rule to your .htaccess (Apache) or nginx.conf so that requests under /es/ serve the static files:
RewriteEngine On
RewriteRule ^es/(.*)$ /public/es/$1 [L]
For Nginx:
location /es/ {
alias /var/www/html/public/es/;
try_files $uri $uri/ =404;
}
Now search‑engine bots receive fully translated HTML, and your Spanish pages gain the same ranking signals as the original English version.
7. Verify the Translation & SEO
- Google Search Console – add the
/es/property and request indexing. - Structured Data Test – ensure any schema (e.g.,
Article) is still present after translation. - Speed Test – the pre‑rendered pages load instantly, improving Core Web Vitals.
8. Advanced Tips
- Dynamic Price Rounding – customize rounding rules per currency in
SiteLocale.init({ priceRounding: { USD: 0.99, EUR: 0.90 } }). - Cache the Translations – store the LLM responses in a transient (WordPress cache) to avoid repeated API calls.
- Multilingual Sitemap – generate a sitemap that includes both
/and/es/URLs; the CLI can outputsitemap.xmlwith the--sitemapflag.
9. Resources
- Detailed installation guide: https://sitelocaleai.com/docs/installation
- SEO CLI documentation: https://sitelocaleai.com/docs/seo-cli
10. Ready to Go?
Deploy SiteLocaleAI on your WordPress site today, serve Spanish‑speaking visitors with lightning‑fast, SEO‑ready pages, and watch your international traffic soar. Try SiteLocaleAI now – the first 30 days are free on the Indie plan, and you can upgrade anytime as you grow.