Change head tags
thomascoppein opened this issue Β· comments
Hi, first of all thanks for the great library! π
I'm using it on an multilang site, so i'm having alternate links in my head. To change this on page change i'm changing this inside my NAVIGATE_IN.
Inside the src code of highway i saw that highway is only changing the document.title. Why not adding an attribute which can be added to an metatag or link tag to reload on NAVIGATE_IN? Such as data-reload. It would be cleaner to have this inside the src code and not in my NAVIGATE_IN π If not, no problem, it's just an idea π
Hello @thomascoppein,
I am not really sure to understand what your idea is, or if I understand it, what it has to do with the "mutlilang" part of your site.
Could you provide additional informations on your idea in a clearer way ? Maybe some code bits for us to get a bit of context ?
Hello @ThaoD5 ,
Thanks for the fast response.
In my head I have two alternate links and one metatag, for example:
<link rel="alternate" href="http://example.com/nl" hreflang="nl" data-reload />
<link rel="alternate" href="http://example.com/en" hreflang="en" data-reload />
<meta property="og:title" content="Home | Example">
When changing to the about page this should be changed to:
<link rel="alternate" href="http://example.com/nl/over" hreflang="nl" data-reload />
<link rel="alternate" href="http://example.com/fr/about" hreflang="en" data-reload />
<meta property="og:title" content="About | Example">
Now I'm manipulating the head inside my NAVIGATE_IN by removing the old alternate links and meta tags and appending them from to.page.head.querySelectorAll('meta, link[data-reload]) for a better SEO score.
My idea was to add the data-reload attribute to a tag inside the head, which is then changed when the new view is updated. So that there is a possibility to change content inside the head like the document.title.
Inside this part of the code inside src/renderer.js:
update() {
// Now we update all the informations in the DOM we need!
// We update the title
document.title = this.properties.page.title;
}
I hope you understand my case / idea?
Yes I understand, but SEO metas are only used / read when the page is hit directly by a navigation, there is no Highway navigation happening before google reading the metas or facebook sharing your page.
The replacement of those values would only be theorical to have something clean inside the code, but it is actually not useful as SEO robots only read your metas & hreflang by direct hit of your URL.
Let me know if you think differently or if I am missing informations, but I think this is a useless procedure :-)
Hey @thomascoppein,
I do agree with @ThaoD5 that it does seem useless to update the metadatas during a Highway navigation, as explained. I'm closing this issue since this doesn't seem to be related to Highway. Please reopen it for further discussions on this topic.
Thanks,
Anthodpnt