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
158 stars 11 forks source link

[Feature Request] Discriminate <Meta> overrides base on other attributes too #29

Open thepra opened 2 years ago

thepra commented 2 years ago

As of now it does seem that the Name property is the only one being used for search and override so if you have some other extra attribute distinguising the <meta>s it does only override the first match by Name, ex.:

<meta name="theme-color" media="(prefers-color-scheme: light)" content="hsl(25,84%,88%)">
<meta name="background-color" media="(prefers-color-scheme: light)" content="hsl(25,84%,88%)">
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="hsl(25,16%,12%)">
<meta name="background-color" media="(prefers-color-scheme: dark)" content="hsl(25,16%,12%)">

as you can see there's the media query that can enable different values based on the color-scheme of the OS but the <Meta> component goes and replaces only the first two values leaving the next two untouched.

Is there a way to have implemented search match based also on other attributes?

jsakamoto commented 2 years ago

@thepra

I published the new version of the Blazor Head Element Helper NuGet packages v.7.1.0.

This version has supported a media attribute in meta elements and identifies them by whether both of name and media attributes are the same inter meta each element.

Could you try it out?

thepra commented 2 years ago

sure

thepra commented 2 years ago

I'm having an issue, it doesn't seem to work, when specifying Media in the Meta component it does render everything except media:... immagine

And it does seem also that it doesn't override correctly because there's a copy left above of the same initial meta tags(from index.html)

jsakamoto commented 2 years ago

@thepra I've not reproduced that problem yet.

Can you reproduce the problem on my sample app I attached below?

📦BlazorServerApp1.zip

thepra commented 2 years ago

ok, nevermind, it does seem to be an issue with Firefox in the end. I did already report the issue there and it's being worked on.