jsakamoto / Toolbelt.Blazor.HeadElement

Head element support (change the document title, "meta" elements such as OGP, and "link" elements) for Blazor apps.
https://demo-blazor-headelement.azurewebsites.net/
Mozilla Public License 2.0
159 stars 11 forks source link

Can only include one HrefLang tag (cannot implement recommended pattern) #24

Closed EricBos closed 2 years ago

EricBos commented 2 years ago

It is recommended to include the current language of a page in the hreflang as well as a link for each and every other language version of a page.

With the current implementation the Hreflang Link elements are overwriting itself.

I think it's because of the code below:

const linkComparer = {
            canonical: () => true,
            prev: () => true,
            next: () => true,
            icon: (m, a) => ('' + m.sizes) === a.s,
            alternate: (m, a) => m.type === a.p && m.media === a.m,
            preload: (m, a) => getAttr(m, href) === a.h && m.media === a.m,
        };

Shouldn't the HrefLang also be part of the link comparison?

jsakamoto commented 2 years ago

@EricBos Thank you for letting me know! 👍 Yes, you are right, I could not realize it until I received your issue post, but HrefLang had to be a part of the link comparison.

I'll fix the "Blazor Head Element Helper" libraries about this point in the near future.

EricBos commented 2 years ago

Awesome! I'll wait for the release then

jsakamoto commented 2 years ago

It took a long time, but I did it. I published v.6.0.1 of these libraries on the nuget.org.

Please try it out.

EricBos commented 2 years ago

No complaints here regarding the speed! Just upgraded my project and it seems to work!

superhappy

Eric

EricBos commented 2 years ago

Confirmed!