3

We're looking to internationalize a WordPress website, and for multiple reasons have decided to go with the subdirectories with global top level domain option:

  • example.com/de/
  • example.com/it/
  • example.com/es/
  • etc

However, we would like the URL slugs to be in the local language, aiming to improve click through rates of local searchers. So that would be,

  • example.com/this-is-a-page
  • example.com/fr/c-est-une-page
  • example.com/es/esta-es-una-página
  • example.com/gr/auti-einai-mia-selida

Is it possible to do this on WordPress? Do you know any such setup examples?

  • 1
    Are these pages going to be translated? In other words, are you going to have the same set of pages in each language that will need hreflang tags between them? – Stephen Ostermiller Feb 22 '18 at 13:57
  • yes, exactly as you said. – Jason Spanomanolis Feb 22 '18 at 13:59
  • I haven't done of of that myself in WP. Here is an article that says that there are plugins that both manage hreflang automatically between translated pages and plugins that allow you to set the hreflangs manually: wpbeginner.com/plugins/how-to-add-hreflang-tags-in-wordpress What you want should at least be possible, even if it takes manual work with the hreflangs. – Stephen Ostermiller Feb 22 '18 at 14:03
1

No plugin required

This can easily be done without a plugin and by using WP page templates

  1. Copy header.php to header-spanish.php
  2. Copy footer.php to footer-spanish.php
  3. Copy page.php to page-spanish.php

Edit page-spanish.php

  1. Change get_header(); to get_header('spanish);
  2. Change get_footer(); to get_footer('spanish');
  3. Remove all information within /* */ and add /* Template Name: Spanish Pages */
  4. Edit a page then on the right side look for "template" which is under attributes, then change the page template to Spanish Pages

Now you have a unique header and footer which will give you more control over your different languages.


What about Hreflang Plugins?

You could however use a hreflang manager however this simply controls the <head> but if you want full control then having template pages is the way to go, espeically if you want different sidebars, footers and headers to match the langure of the page.


3 Methods to rewrite URLs with country speific codes e.g /es/

  • Add a blank page called es with permalink /es/, then make the page noindex, then on your pages that are spanish, simply use parent es which will add the country code to the URL.
  • Use a rewrite plugin.
  • Use the WordPress Rewrite API

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.