Skip to content
    Moz logo Menu open Menu close
    • Products
      • Moz Pro
      • Moz Pro Home
      • Moz Local
      • Moz Local Home
      • STAT
      • Moz API
      • Moz API Home
      • Compare SEO Products
      • Moz Data
    • Free SEO Tools
      • Domain Analysis
      • Keyword Explorer
      • Link Explorer
      • Competitive Research
      • MozBar
      • More Free SEO Tools
    • Learn SEO
      • Beginner's Guide to SEO
      • SEO Learning Center
      • Moz Academy
      • SEO Q&A
      • Webinars, Whitepapers, & Guides
    • Blog
    • Why Moz
      • Agency Solutions
      • Enterprise Solutions
      • Small Business Solutions
      • Case Studies
      • The Moz Story
      • New Releases
    • Log in
    • Log out
    • Products
      • Moz Pro

        Your all-in-one suite of SEO essentials.

      • Moz Local

        Raise your local SEO visibility with complete local SEO management.

      • STAT

        SERP tracking and analytics for enterprise SEO experts.

      • Moz API

        Power your SEO with our index of over 44 trillion links.

      • Compare SEO Products

        See which Moz SEO solution best meets your business needs.

      • Moz Data

        Power your SEO strategy & AI models with custom data solutions.

      NEW Keyword Suggestions by Topic
      Moz Pro

      NEW Keyword Suggestions by Topic

      Learn more
    • Free SEO Tools
      • Domain Analysis

        Get top competitive SEO metrics like DA, top pages and more.

      • Keyword Explorer

        Find traffic-driving keywords with our 1.25 billion+ keyword index.

      • Link Explorer

        Explore over 40 trillion links for powerful backlink data.

      • Competitive Research

        Uncover valuable insights on your organic search competitors.

      • MozBar

        See top SEO metrics for free as you browse the web.

      • More Free SEO Tools

        Explore all the free SEO tools Moz has to offer.

      What is your Brand Authority?
      Moz

      What is your Brand Authority?

      Check yours now
    • Learn SEO
      • Beginner's Guide to SEO

        The #1 most popular introduction to SEO, trusted by millions.

      • SEO Learning Center

        Broaden your knowledge with SEO resources for all skill levels.

      • On-Demand Webinars

        Learn modern SEO best practices from industry experts.

      • How-To Guides

        Step-by-step guides to search success from the authority on SEO.

      • Moz Academy

        Upskill and get certified with on-demand courses & certifications.

      • SEO Q&A

        Insights & discussions from an SEO community of 500,000+.

      Unlock flexible pricing & new endpoints
      Moz API

      Unlock flexible pricing & new endpoints

      Find your plan
    • Blog
    • Why Moz
      • Small Business Solutions

        Uncover insights to make smarter marketing decisions in less time.

      • Agency Solutions

        Earn & keep valuable clients with unparalleled data & insights.

      • Enterprise Solutions

        Gain a competitive edge in the ever-changing world of search.

      • The Moz Story

        Moz was the first & remains the most trusted SEO company.

      • Case Studies

        Explore how Moz drives ROI with a proven track record of success.

      • New Releases

        Get the scoop on the latest and greatest from Moz.

      Surface actionable competitive intel
      New Feature

      Surface actionable competitive intel

      Learn More
    • Log in
      • Moz Pro
      • Moz Local
      • Moz Local Dashboard
      • Moz API
      • Moz API Dashboard
      • Moz Academy
    • Avatar
      • Moz Home
      • Notifications
      • Account & Billing
      • Manage Users
      • Community Profile
      • My Q&A
      • My Videos
      • Log Out

    The Moz Q&A Forum

    • Forum
    • Questions
    • Users
    • Ask the Community

    Welcome to the Q&A Forum

    Browse the forum for helpful insights and fresh discussions about all things SEO.

    1. Home
    2. SEO Tactics
    3. Technical SEO
    4. Custom hreflang tags in WP & using with Yoast

    Moz Q&A is closed.

    After more than 13 years, and tens of thousands of questions, Moz Q&A closed on 12th December 2024. Whilst we’re not completely removing the content - many posts will still be possible to view - we have locked both new posts and new replies. More details here.

    Custom hreflang tags in WP & using with Yoast

    Technical SEO
    4
    8
    14108
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as question
    Log in to reply
    This topic has been deleted. Only users with question management privileges can see it.
    • Dan-Lawrence
      Dan-Lawrence last edited by

      Hi

      My clients dev has added custom fields for adding hreflang tags to head of pages such as:

      "Rel Type", "The URL", and "Language Code"

      Am i right in thinking that until a different language/country version of the site is created these can remain empty or should they still be populated once added say with some sort of global reference or best left blank since will leave the head content global by default ?

      Also how important is it to add charset to the language code ? since seems optional ?

      Also this set up is on WP multi-site with Yoast and devs asked me the below:

      _One thing to note is that Yoast generates its own "canonical" tags - so if _
      _you are going to use hreflang tags and canonical tags then you don't need to _
      _add a canonical using the custom fields I have set up - Yoast has that _
      sorted.

      _But if you are going down the route of NOT having any canonical tags - and _
      _using a x-defult for the hreflang tags, I will need to try and suppress the _
      _Yoast canonical tag so you can do this. Much depends on your approach and _
      what you think is best.

      So how do i know if using canonicals or x-default, i take it best simplest to leverage Yoast and hence not add canonicals to custom fields ? Isnt x-default just for indicating language selectors/redirector not specific to 1 region? So long as havnt got those then good to proceed with Yoasts generated canonicals ?

      Cheers

      dan

      1 Reply Last reply Reply Quote 0
      • dalapayal
        dalapayal last edited by

        Hello,

        I have a Blog In Which I am Using Google Translate, Which Can Convert the Blog into Multilanguages. Is it Suggested to use Herflang Tags in My Blog. Thanks In Advance ( Blog I Have Mention is signature)

        Ashish Sharma

        Govtjobstyari.com

        1 Reply Last reply Reply Quote 0
        • Dan-Lawrence
          Dan-Lawrence @FedeEinhorn last edited by

          Thanks again really is a big help 🙂

          Ive read that correct charsets are important, i take it that plugin handles that correctly ?

          Do you know if plugin should work fine in WP Multisite environment with network childs domain mapped with their cctlds ?

          Re: "using x-default and removing the canonical is nonsense" The dev just meant if going down route of NOT using canonicals AND using x-default in the hreflang then would need to suppress Yoast in those instances.

          Re:  "In my example, I used two very similar (if not the same langs), however there are things that change, but those are minimal (take as an example a car "hood", in England a "bonnet"). As those are such minimal changes, I don't think a specific version for GB is needed if you are already serving a US version (that's up to you)."    Would you say the same if phrases containing these regional variations (hood vs bonnet) were on your target kw list ? Since i find that whilst Google is getting better at semantic relationships between words i think that they do need to be specifically targeted/appear in content & meta data in order to rank for them, or at least increase chances of ranking for them.

          Also re your final paragraph 'car repair centers' would be a logical target kw for such a page so i would have thought it would be beneficial to create 2 versions of this page, 1 for US targeting US spelling & 1 for UK targeting UK spelling (centers vs centres), rather than 1x English to serve both UK & US audiences

          Also I would have thought it would be useless showing a list of US car repair centers to UK visitors ?

          Sorry for more questions, think that should be it now & thanks again 🙂

          All Best

          Dan

          1 Reply Last reply Reply Quote 1
          • FedeEinhorn
            FedeEinhorn last edited by

            Dan,

            If you have an English page that is also available on Turkish (same content but rewritten/translated) then an hreflang tag is recommended, not mandatory, but recommended. Although as you said you are already writing in Turkish and geotargeting in GWT, there are other engines too, that regardless their market share, shouldn't be overlooked.

            HOWEVER, if you have a page in English not matching a Turkish page, then you don't need the hreflang in that page. The tag is only used when the same content is available on other language/location to tell engines which version they should serve.

            What you mention about using x-default and removing the canonical is nonsense. Those are 2 different things and one would not interfere with the other. The plugin I recommended does not mess with Yoast, leaving the canonicals as they should be and adding the hrefland tags as specifies. Check this example on my site English and Spanish using both Yoast and the hreflang Manager plugin:

            • English: http://viberagency.com/blog/6-reasons-shouldnt-put-intern-charge-companys-social-media/
            • Spanish: http://es.viberagency.com/blog/6-razones-por-las-que-debes-dejar-un-pasante-cargo-de-los-medios-sociales-de-tu-empresa/

            Check the source code, both have their canonicals and hreflang tags just fine. We chose to use the English version as the default, as you can see in the x-default.

            The hreflang tags should be used only when the content is the same (but targeted to a different audience). Of course of the translation from one language to the other some lines must be rewritten to make sense.

            In my example, I used two very similar (if not the same langs), however there are things that change, but those are minimal (take as an example a car "hood", in England a "bonnet"). As those are such minimal changes, I don't think a specific version for GB is needed if you are already serving a US version (that's up to you). In that case (1 english version to all english speakers), you only specify the language, instead of the Language and Region:

            <link rel="<a class="attribute-value">alternate</a>" href="http://www.example.com" hreflang="<a class="attribute-value">en</a>"/>

            Now, just to make sure we have an example that DOES apply a different GEO in en-US and en-GB, could be a page that explains what are car repair centers, plus below it shows a list of repair centers. In these scenario, the content is the same, but the list of repair centers change, you would like to display those in GB to your GB audience (still, from my point of view, useless, but was just an example).

            Hope that clears it up 🙂

            Dan-Lawrence 1 Reply Last reply Reply Quote 1
            • Dan-Lawrence
              Dan-Lawrence @FedeEinhorn last edited by

              Hi Apog

              Thanks so much for all that great info !

              First of all, the main default site is for general/global targeting so have instructed dev to put on network.domain.com/en (but mapped to tld domain.com) to signify english but not be country specific - global kw research has determined USA spelling to be used predominently with just one or two UK spelt target kw).

              The next stage is a Turkish geotargeted site that will be in Turkish language on our WP MS network network.domain.com/tr but mapped with a tld such as www.domain.tr which will be geotargeted in GWT. Given these other geo signals such as gwt, native language in body copy etc is hreflang even needed for such a scenario or due to  hreflang is overkill/not needed ?

              Re your example (US/GB): You are saying use x-default but my dev says (copied in my question) that if we want to use x-default then would have to suppress Yoast re the canonical, so any ideas how to resolve that ? Does the plugin you linked to handle hreflang without requiring Yoast to be suppressed re having x-default or not applicable since only refers to scenario where not having canonicals.

              Also you say your example set up is if the contents not exactly the same, do you mean if they have substantially different content ? And your second point (below the example set up) says if they have the same content - so here do you mean if the only difference is US/vsGB versions of english language/spelling but otherwise identical ? And if our target kw include the USvsGB spelling variations then i take it the en-gb version isnt expendable after all ?

              Thanks for all your help and sorry for more questions but i really need to get to the bottom of this asap 🙂

              Many Thanks

              Dan

              1 Reply Last reply Reply Quote 0
              • Dan-Lawrence
                Dan-Lawrence @KristinaKledzik last edited by

                thanks Kristina !

                1 Reply Last reply Reply Quote 0
                • FedeEinhorn
                  FedeEinhorn last edited by

                  Hey Dan,

                  If I understood correctly, you should use both. Canonical tags are used tell search engines that the content is located on the canonical content, while hreflang points which version should be served to each visitor depending on the user's location/language.

                  If you Yoast, then they already handle the canonical tags and there's nothing you need to do. For the hreflang, if you have at the moment only 1 version served to all visitors, then those shouldn't be used. However, if you have 2 versions quite similar, like en-US and en-GB then you will need to choose the one that's default, let's say the US version and have the following on each version:

                  en-US:

                  • Canonical pointing to it.
                  • Hreflang x-default pointing to it
                  • Hreflang en-US pointing to it
                  • Hreflang en-GB pointing to en-GB version

                  en-GB:

                  • Canonical pointing to it.
                  • Hreflang x-default pointing to en-US
                  • Hreflang en-US pointing to en-US
                  • Hreflang en-GB pointing to it

                  This applies if the en-US and en-GB versions are NOT exactly the same. If the language changes (that's why you create a specific version to each country) you need a canonical in each version pointing to itself.

                  If the en-US and en-GB have the same contents, then the canonical should point to the en-US version (but there's no need to have the en-GB version really, which makes it useless / expendable).

                  As you mention that at the moment you do not have any extra langs/regions, then you could leave the tags empty or better remove them.

                  There's a plugin for wordpress that handles hreflang tags (paid) hreflang Manager

                  Hope that helps!

                  Dan-Lawrence 1 Reply Last reply Reply Quote 1
                  • KristinaKledzik
                    KristinaKledzik last edited by

                    No need to worry about hreflang (and therefore x-default) unless you're working with international versions of your sites! If Google doesn't see anything referencing international, it will figure out the language and country from the ccTLD and the language you're using on your site. Hreflang tells Google where the international versions of a page are, it isn't necessary to designate a language and location.

                    Best,

                    Kristina

                    Dan-Lawrence 1 Reply Last reply Reply Quote 2
                    • 1 / 1
                    • First post
                      Last post

                    Got a burning SEO question?

                    Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.


                    Start my free trial


                    Browse Questions

                    Explore more categories

                    • Moz Tools

                      Chat with the community about the Moz tools.

                    • SEO Tactics

                      Discuss the SEO process with fellow marketers

                    • Community

                      Discuss industry events, jobs, and news!

                    • Digital Marketing

                      Chat about tactics outside of SEO

                    • Research & Trends

                      Dive into research and trends in the search industry.

                    • Support

                      Connect on product support and feature requests.

                    • See all categories

                    Related Questions

                    • Chophel

                      My WP website got attack by malware & now my website site:www.example.ca shows about 43000 indexed page in google.

                      Hi All My wordpress website got attack by malware last week. It affected my index page in google badly. my typical site:example.ca shows about 130 indexed pages on google. Now it shows about 43000 indexed pages.  I had my server company tech support scan my site and clean the malware yesterday. But it still shows the same number of indexed page on google. Does anybody had ever experience such situation and how did you fixed it. Looking for help. Thanks FILE HIT LIST:
                      {YARA}Spam_PHP_WPVCD_ContentInjection : /home/example/public_html/wp-includes/wp-tmp.php
                      {YARA}Backdoor_PHP_WPVCD_Deployer : /home/example/public_html/wp-includes/wp-vcd.php
                      {YARA}Backdoor_PHP_WPVCD_Deployer : /home/example/public_html/wp-content/themes/oceanwp.zip
                      {YARA}webshell_webshell_cnseay02_1 : /home/example2/public_html/content.php
                      {YARA}eval_post : /home/example2/public_html/wp-includes/63292236.php
                      {YARA}webshell_webshell_cnseay02_1 : /home/example3/public_html/content.php
                      {YARA}eval_post : /home/example4/public_html/wp-admin/28855846.php
                      {HEX}php.generic.malware.442 : /home/example5/public_html/wp-22.php
                      {HEX}php.generic.cav7.421 : /home/example5/public_html/SEUN.php
                      {HEX}php.generic.malware.442 : /home/example5/public_html/Webhook.php

                      Technical SEO | | Chophel
                      0
                    • NickG-123

                      Duplicate titles from hreflang variations

                      Hi, I am working on a large global site which has around 9 different language variations. We have setup the hreflang tags and referenced the corresponding content as follows: (We have not implemented a version X-default reference, as we felt it was not necessary) Using DeepCrawl and Search Console, we can see that these language variations are causing duplicate title issues. Many of them. My assumption was that the hreflang would have alleviated this issue and informed Google what is going on, however i wanted to see if anyone has any experience with this kind of thing before. It would be good to understand what the best practice approach is to deal with the problem. Is it even an issue at all, or just the tools being over-sensitive? Thank you in advance.

                      Technical SEO | | NickG-123
                      0
                    • simonatkinsphoto

                      Yoast and wordpress duplicate meta

                      I'm using the Yoast plugin with wordpress and have noticed in my HTML I have duplicate meta data. For example my header starts with 
                      <title>(title) </title<span><<br /><meta </span><span class="html-attribute-name">property</span><span>="</span><span class="html-attribute-value">og:site_name</span><span>" </span><span class="html-attribute-name">content</span><span>=<br /><span><meta </span><span class="html-attribute-name">property</span><span>="</span><span class="html-attribute-value">og:description</span><span>" </span><span class="html-attribute-name">content</span><span>=<br /><br /></span></span>Then I have the 'This site is optimised by Yoast" tagline followed by the same meta -<br /> <span><meta </span><span class="html-attribute-name">name</span><span>="</span><span class="html-attribute-value">description</span><span>" </span><span class="html-attribute-name">content=<br /><span> <meta </span><span class="html-attribute-name">property</span><span>="</span><span class="html-attribute-value">og:title</span><span>" content=<br /><span> <meta </span><span class="html-attribute-name">property</span><span>="</span><span class="html-attribute-value">og:description</span><span>" </span><span class="html-attribute-name">content=<br /><span> <meta </span><span class="html-attribute-name">property</span><span>="</span><span class="html-attribute-value">og:site_name</span><span>" </span><span class="html-attribute-name">content</span><span>=<br /><br /></span></span></span></span>Is this likely to cause problems with Google and is there a way to stop both wordpress and Yoast adding meta to the header. </p></title>

                      Technical SEO | | simonatkinsphoto
                      0
                    • jessicarcf

                      Removing a canonical tag from Pagination pages

                      Hello, Currently on our site we have the rel=prev/next markup for pagination along with a self pointing canonical via the Yoast Plugin. However, on page 2 of our paginated series, (there's only 2 pages currently), the canonical points to page one, rather than page 2. My understanding is that if you use a canonical on paginated pages it should point to a viewall page as opposed to page one. I also believe that you don't need to use both a canonical and the rel=prev/next markup, one or the other will do. As we use the markup I wanted to get rid of the canonical, would this be correct? For those who use the Yoast Plugin have you managed to get that to work? Thanks!

                      Technical SEO | | jessicarcf
                      0
                    • danwebman

                      Guys & Gals anyone know if urllist.txt is still used?

                      I'm using a tool which generates urllist.txt and looking on the SEO Forums it seems that Yahoo used to use this. What I'd like to know is is it still used anywhere and should we have it on the site?

                      Technical SEO | | danwebman
                      0
                    • Pete4

                      Can I have an H1 tag below an H2?

                      Quick question for you all - Is there an issue with me having an H1 tag physically below an H2 tag on a web page??

                      Technical SEO | | Pete4
                      0
                    • vivadata

                      Yoast SEO Plugin and Theme Conflict - Meta Tags

                      I have installed yoast seo plugin and a theme that I purchased.
                      I have added site title and meta description for the index page through yoast seo plugin see here http://screencast.com/t/AdjMynym8Tm however this does not work as can be seen on the test site
                      http://importingtips.com/test/ does anyone have any advice? Thanks

                      Technical SEO | | vivadata
                      0
                    • themegroup

                      Effective use of hReview

                      Hi fellow Mozzers! I am just in the process of adding various reviews to our site (a design agency), but I wanted to use the ratings in different ways depending on the page. So for the home page and the services (branding, POS, direct mail etc) I wanted to aggregate relevant reviews (giving us an average of all reviews for the home page, an average of ratings from all brand projects and so on). Then, I wanted to put specific reviews on our portfolio pages, so the review relates specifically to that project. This is the easiest to do as the hReview generator is geared up for reviews that come from one source, but I can't find a way of aggregating the star ratings to make an average rating rich snippet. Anyone know where I can get the coding for this? Thanks in advance! Nick.

                      Technical SEO | | themegroup
                      0

                    Get started with Moz Pro!

                    Unlock the power of advanced SEO tools and data-driven insights.

                    Start my free trial
                    Products
                    • Moz Pro
                    • Moz Local
                    • Moz API
                    • Moz Data
                    • STAT
                    • Product Updates
                    Moz Solutions
                    • SMB Solutions
                    • Agency Solutions
                    • Enterprise Solutions
                    Free SEO Tools
                    • Domain Authority Checker
                    • Link Explorer
                    • Keyword Explorer
                    • Competitive Research
                    • Brand Authority Checker
                    • MozBar Extension
                    • MozCast
                    Resources
                    • Blog
                    • SEO Learning Center
                    • Help Hub
                    • Beginner's Guide to SEO
                    • How-to Guides
                    • Moz Academy
                    • API Docs
                    About Moz
                    • About
                    • Team
                    • Careers
                    • Contact
                    Why Moz
                    • Case Studies
                    • Testimonials
                    Get Involved
                    • Become an Affiliate
                    • MozCon
                    • Webinars
                    • Practical Marketer Series
                    • MozPod
                    Connect with us

                    Contact the Help team

                    Join our newsletter
                    Moz logo
                    © 2021 - 2025 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
                    • Accessibility
                    • Terms of Use
                    • Privacy

                    Looks like your connection to Moz was lost, please wait while we try to reconnect.