Slugs are a URL friendly of the post title. WordPress automatically generates slugs but you can edit and translate slugs below the post title. In this post I show you some tips to translate slugs in your WordPress site: Remove stop words, use short slugs but containing the most important keywords, use transliteration for non-Latin alphabets and don’t forget to translate slugs in categories, tags and custom post types.
UPDATE 3/12/2020: It is OK to use Unicode characters inside slugs, no need for transliteration.
Introduction
A slug is the end part of the URL which identifies a post or page using human-readable keywords. This name is based on the use of “slug” in the news media to indicate a short name given to an article only for internal use.
Slugs are usually a URL friendly version of the post title. WordPress automatically generates slugs from a post’s title but a slug can be anything you like. You can edit the slug below the post title. Slugs are meant to be used with permalinks as they help describe what the content at the URL is.
Slugs are usually entirely lowercase, in Latin letters, without accents, umlauts or apostrophes and whitespace characters replaced by hyphens, in order to avoid being encoded. Punctuation marks are generally removed.
Once it is published, the slug should not be changed. If it is changed any links to your older page will be broken because the permalink to your post will now be different.
Examples
English:
- Original title: How to translate slugs in WordPress
- Automatically generated slug: how-to-translate-slugs-in-wordpress
- Manually edited slug: translate-slugs-wordpress
- Permalink: https://wplang.org/translate-slugs-wordpress
You can edit and change the slug below the post title or with the quick editor:
Spanish:
- Original title: Cómo traducir los slugs en WordPress
- Automatically generated slug: como-traducir-los-slugs-en-wordpress
- Manually edited slug: traducir-slugs-wordpress
- Permalink: http://es.wplang.org/traducir-slugs-wordpress
Why translate slugs
Slugs always must be translated for different reasons:
- Make URL most intelligible to humans in different languages
- Search engines give attention to the URL slugs
- URL slugs that you use in your WordPress webpage will appear in the SERPs. This is visible to people around the world who are searching in the web
Some tips when translating slugs
1. Remove stop words and use hyphens
A stop word is a commonly used word (“a”, “and”, “the”, etc) that a search engine has been programmed to ignore, both when indexing entries for searching and when retrieving them as the result of a search query.
When translating a post title, WordPress automatically generates slugs in the new language version. You can avoid stop words in two ways:
- Editing the slug and removing them manually
- Using a plugin. For example, WordPress SEO by Yoast can automatically remove stop words from your slugs once you save a page or post
Don’t use accents, umlauts or apostrophes to keep slugs readable and SEO friendly. Anyway, WordPress will not let you use them in slugs
Also, WordPress use hyphens (-) instead of undercores (_). Google recommend use hyphens in your URLs.
French example:
- Title: L’histoire de France
- Slug: histoire-france
2. Use transliteration for non-Latin alphabets
UPDATE 3/12/2020: It is OK to use Unicode characters inside slugs, no need for transliteration.
When it comes to translating slugs to languages with non-Latin alphabet or containing non-Latin letters, a good solution is to use transliteration.
The transliteration process means that a word written in a character set (like the Cyrillic alphabet) is transposed in another alphabet (Latin).
This way you can create human-readable links and different alphabets are not mixed in the same URL. In addition, the major search engines understand perfectly transliterated language
Russian example:
- Original title: Контакты
- Original slug: контакты
- Original permalink: http://ru.wplang.org/контакты
- Trasliterated slug: kontakty
- Permalink: http://ru.wplang.org/kontakty
There are different plugins that can help you to transliterate slugs automatically. Some examples:
- Cyr to Lat enhanced. Converts Cyrillic and Georgian characters in post, page and term slugs to Latin characters
- Arabic-to-latino converts Arabic characters in slugs to Latin characters. Very useful for Arab-speaking users of WordPress
- German Slugs transliterates umlauts and the letter ß appearing in titles for slugs
Note: In recent years have appeared new domain names in non-Latin alphabets. For example, .РФ domain names in Russia. Obviously in these cases is no longer appropriate to use transliteration
3. Use short slugs and containing the most important keywords in each language
In order to make slugs more memorable you can use shorter URL slugs when translating, but note that the slug should contain the most important keywords of your post in each language (2, 3, 4 or 5 keywords max). Google likes a short slug that contains the keywords describing the post.
4. Don’t forget to translate slugs in categories, tags and custom post types
The slugs of categories, tags and custom post types also must be translated:
Some tips:
- You can strip the category base (/category/) from the category URL, using WordPress SEO by Yoast. Go to SEO > Permalink settings and check the box “Strip the category base”.
- There is a plugin, called Edit Author Slug, that allows an admin (or capable user) to edit the author slug of a user, and change the author base.
Conclusions
There are different aspects to consider when managing slugs in other languages:
- Always translate slugs into other languages to keep them readable and SEO friendly
- Use transliteration when translating a non-Latin alphabet
- Use short slugs but containing the most important keywords
- Don’t forget to translate slugs in categories, tags and custom post types
If you are using GTranslate with URL Translation feature included to make your WordPress multilingual, you can modify URL Translations from the in-context edit interface.
I hope this article has helped you translate your website slugs. What other considerations do you have in mind when translating slugs?
seo says
Great this post, very thank you for your sharing
David Gray says
Thank you for this post. Just wondering why slugs need to be transliterated from a non-roman alphabet language to the alphabet. My blog is written mostly in Japanese and I was thinking I should use japanese for slugs for when Japanese people make searches (SEO) in Japanese.
Irena Domingo says
Thank you for your comment!
David says
Could you tell me why slugs need to be transliterated from a non-roman alphabet language to the alphabet?. My blog is written mostly in Japanese and I was thinking I should use japanese for slugs for when Japanese people make searches (SEO) in Japanese.
Irena Domingo says
It is not mandatory, but I think it’s a good choice because you can create human-readable links and different alphabets are not mixed in the same URL. Also, search engines understand transliterated slugs.
David Gray says
Thanks so much! That makes sense!
Mehdi says
Hi thank a lot for this useful article.
I went to database and saw the slug have changed into unfamiliar characters
I manually changed the slug into RTL language but in my post the slug convert into unfamiliar characters.Can I change wordpress source to correct this bug?