Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New to the CF scene
    Join Date
    Sep 2015
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    incorrect hreflang implementation

    Hi, I'm new to this forum and need a bit of help. Search Console is telling me "Incorrect hreflang implementation on http://byjohan.se/"

    I've chosen to implement hreflang via my sitemap. Here's a section from my sitemap:

    "<url>
    <loc>http://byjohan.se/contact.html</loc>
    <xhtml:link rel="alternate" hreflang="sv" href="http://byjohan.se/kontakta.html" />
    <lastmod>2012-03-13T13:25:14+00:00</lastmod>
    <changefreq>weekly</changefreq>
    </url>
    <url>
    <loc>http://byjohan.se/kontakta.html</loc>
    <xhtml:link rel="alternate" hreflang="en" href="http://byjohan.se/contact.html" />
    <lastmod>2012-03-13T13:25:14+00:00</lastmod>
    <changefreq>weekly</changefreq>
    </url>"

    I cannot see what I'm doing wrong - this is also what I believe Search Console suggests the code should look like.

    Any help would be appreciated

  2. #2
    Master Coder sunfighter's Avatar
    Join Date
    Jan 2011
    Location
    West Des Moines, Iowa
    Posts
    8,171
    Thanks
    38
    Thanked 1,090 Times in 1,086 Posts
    Welcome to the forums lljooo. Some things you should know. First, this is the HTML/CSS section of the forum. People here may not know xml and therefore you wont get an answer. Second you need to enclose your code in CODE tags as per: http://www.codingforums.com/html-and...uidelines.html

    An answer:
    All open xml tags should be closed. "<xhtml:link>" needs to be closed.
    Is the :link necessary for this tag? I would use "<link>".
    All xml files need to be started with "<?xml version="1.0" encoding="UTF-8"?>".

    Try this and see if it works for you:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <url>
    <loc>http://byjohan.se/contact.html</loc>
    <link> rel="alternate" hreflang="sv" href="http://byjohan.se/kontakta.html" /></link>
    <lastmod>2012-03-13T13:25:14+00:00</lastmod>
    <changefreq>weekly</changefreq>
    </url>
    
    <url>
    <loc>http://byjohan.se/kontakta.html</loc>
    <link> rel="alternate" hreflang="en" href="http://byjohan.se/contact.html" /></link>
    <lastmod>2012-03-13T13:25:14+00:00</lastmod>
    <changefreq>weekly</changefreq>
    </url>
    Evolution - The non-random survival of random variants.
    Physics is actually atoms trying to understand themselves.

  3. #3
    New to the CF scene
    Join Date
    Sep 2015
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks! Sorry about the non-enclosing of code. And for posting in the wrong section

    I've tried what you suggested (minus the > after link). I guess it'll take some time before Google reacts on it. Again thanks!

  4. #4
    New to the CF scene
    Join Date
    Sep 2015
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It didn't work out. It seems since I once created an xml-sitemap it expects one in xml. So I guess I need those "xhtml:link". Not sure what's wrong in it, though

  5. #5
    New to the CF scene
    Join Date
    Sep 2015
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I've posted this in the xml-section so Moderator could remove this one.

  6. #6
    Administrator VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    11,386
    Thanks
    7
    Thanked 1,370 Times in 1,339 Posts
    No, don’t cross post. Rather, ask a moderator to move your thread to the appropriate section. You can use the report button for this (small triangle icon with exclamation mark below the post). Now you know for next time.

  7. #7
    New to the CF scene
    Join Date
    Sep 2015
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by VIPStephan View Post
    No, don’t cross post. Rather, ask a moderator to move your thread to the appropriate section. You can use the report button for this (small triangle icon with exclamation mark below the post). Now you know for next time.
    Sorry about that. It's been moved now, I can see... Thanks.

  8. #8
    Master Coder sunfighter's Avatar
    Join Date
    Jan 2011
    Location
    West Des Moines, Iowa
    Posts
    8,171
    Thanks
    38
    Thanked 1,090 Times in 1,086 Posts
    Quote Originally Posted by lljooo View Post
    It didn't work out. It seems since I once created an xml-sitemap it expects one in xml. So I guess I need those "xhtml:link". Not sure what's wrong in it, though
    I sounds to me that you should change the xml-sitemap, I don't know what that is, the two should match.
    Look at this site: https://www.xml-sitemaps.com/
    Evolution - The non-random survival of random variants.
    Physics is actually atoms trying to understand themselves.

  9. #9
    New to the CF scene
    Join Date
    Sep 2015
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by sunfighter View Post
    I sounds to me that you should change the xml-sitemap, I don't know what that is, the two should match.
    Look at this site: https://www.xml-sitemaps.com/
    Yes, it's the sitemap.xml that is to be changed. I think I originally created it using the page you're linking to. However, after trying to make my site more mobile friendly, I had to add those mobile friendly pages in the sitemap.xml and that's when I started getting the "incorrect hreflang implementation..." So, most likely, there's something wrong in that code that I pasted here...


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •