Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close syntax missing in Hreflang Tag #1144

Open
RajMankotia opened this issue Aug 29, 2023 · 15 comments
Open

Close syntax missing in Hreflang Tag #1144

RajMankotia opened this issue Aug 29, 2023 · 15 comments

Comments

@RajMankotia
Copy link

Hi @lydiapuric,
Please check the hreflang tag for all where we implemented we did not close the tag with "/>"

in old we have like this-

--   |   |   |   |   |   |

This we have now-
image

Please fix this.

@lydiapuric
Copy link
Collaborator

@RajMankotia As far as I know it doesn't matter if tags are self-closing when they've been processed by the DOM and otherwise the browser itself would take care of that. What is the impact you see?

@RajMankotia
Copy link
Author

I am getting this error -
image

and if I am checking on the web it shows -

they close at the end by "/>" but we close like this ">"

Please add "/" in last "/>".

@lydiapuric
Copy link
Collaborator

I will address this issue today, thanks Raj

@RajMankotia
Copy link
Author

or we can try and check if it resolves this then it's fine.

@jose-correia
Copy link
Collaborator

@RajMankotia

  • how are you accessing the page, how can i reproduce the error?

Adding this self-closing tags manually is not an option, since even if we do, the browser will remove them. This happens according to https://developer.mozilla.org/en-US/docs/Glossary/Void_element

I checked the old website in https://live-md30.pantheonsite.io/ and I also dont see any self-closing tags />

@RajMankotia
Copy link
Author

RajMankotia commented Aug 31, 2023

It's from old website -

and it's that we implemented on migrated

at the end .com/" />
Currently, we have .com/">

I don't know more about coding but everywhere I see this tag applied or suggested on web they have closed it with a forward slash ( / ) at the end, but in our case, it's not.

@mhaack
Copy link
Contributor

mhaack commented Aug 31, 2023

@RajMankotia what is the tool you use to check which complains?

Also, please double check on the old site: if you do view source yes there is a /> at the end. However if you do inspect the link tags also just end with >. This is correct according the HTML standards as @jose-correia shared the links and the browser corrects it.

Additionally you can test the following lines in any browser console:

const link = document.createElement('link');
link.rel = "alternate";
link.hreflang = 'ko';
link.href = 'https://ko.moleculardevices.com';
console.log(link);

You will see the link tag has no /> at the end.

@RajMankotia
Copy link
Author

Hi, it shows an error for x-default - “no return tags”. will you please check for rest of i shows all ok
image

@RajMankotia
Copy link
Author

Hi @mhaack
Even SEMrush also shows the error -
image

@alexcarol
Copy link
Collaborator

From what I see in the original site the links were already present in the html, could the issue be that we're adding them with javascript?

@RajMankotia
Copy link
Author

There is a chance that different syntax is used in JavaScript for the hreflang tag. It is like the old HTML that we used.

@mhaack
Copy link
Contributor

mhaack commented Sep 1, 2023

From what I see in the original site the links were already present in the html, could the issue be that we're adding them with javascript?

Yes that is the case, as these check tools don't execute JS

@jose-correia
Copy link
Collaborator

jose-correia commented Sep 1, 2023

@mhaack @RajMankotia effectively when I do a curl GET request on the site page, the response does not contain any hreflang tags
Probably they are being added afterwards.

This could be the issue since the tool GETs the page, doesnt see the tags and reports the error

@mhaack
Copy link
Contributor

mhaack commented Sep 1, 2023

@jose-correia yes they are added client side

@RajMankotia
Copy link
Author

@jose-correia got it but eventually it should get verified by Semrush as this is the same tool used and suggested by business. @mhaack as discussed in last call can we add it via meta tag?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants