Lang and hreflang code

Hi so, I recently took over a company page from a prior developer, and i am just a marketeer. Now the site hasn’t been updated since 2021.

So i was doing some SEO work and I came across some coding issues that are being flaggeds as negatively impacting by Screaming Frog. We have a danish site with and english version connected

The error related to our hreflang code and lang code which has been put in before my time, and in my limited experience the code should be correct.

On each page the following code is set.

html lang=“da-dk”
link rel=“alternate” hreflang=“da-dk” href=“https://www.example.dk/
link rel=“alternate” hreflang=“en” href="https://www.example.dk/en/home"/"

But screaming frog flags our pages as having invalid html code in our <head. So how do i fix this

Hi Anja,

Webflow did not have a Localization feature in 2021, which means you’re likely using something like WeGlot which has some SEO issues. You’ll want to figure out what platform is being used and explore there, or else consider redesigning around Localization.

Hi, as far as I can see we have just created a parentfolder called /en on our website duplicated every page and manually translated them, and added the code I provided.

There is no added custom code that includes weglot

I see, in that case, you can just create the code you want yourself. Webflow will just publish whatever you put in the head custom code for your page, so you need to examine and fix your code.

The pseudocode you gave would look more like this;

<link rel="alternate" hreflang="da-dk" href="https://www.example.dk/">
<link rel="alternate" hreflang="en" href="https://www.example.dk/en/home">

Ok so you would delete<html lang=“da-dk”>?

Well you wouldn’t repeat the HTML element, but yes you’d want the lang attribute relevant for each page. Note WF sets this automatically site wide if you specify it in site settings, so it could be a reserved attribute.

I am not sure that I am following what you’re saying (english is not my first language and i have 0 coding experience).

I just want my SEO placement to not be affected by this code. And right now it says that my coding in the head is wrong. My first code is exactly like yours with the only exeption being that I have the Lang attribute thingy. Should i delete that since Wordflow sets the language? And how will google know that my other site map is english and not danish if i delete it.

That will be tricky since you’re building a custom localization solution. It will take some research and experimentation for you. You already understand what’s needed;

  • Each page identifies its language with <html lang=x>
  • Each page points to other language translations with <link rel=alternate ...>
  • Ideally, all of this is also reflected in your sitemap.xml

Webflow localization does all of that for you, if you don’t want to use it you’ll need to build those features most likely using some custom code for certain pieces.

If you do use custom code, tools like Screaming frog likely won’t detect your setup and will still give errors, but if you’ve done it right Google will execute your code fine.

Alright, i’m glad that I appear to atleast partially understand what i’m needing. Is there a way to check how Google is executing my code?

Use Google search console, it will raise errors if it’s having problems.
Unfortunately they just recently shut down the cache feature so I don’t know of a way to see the page code they’ve indexed.