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

[Feature request] Support multiple <meta name="theme-color"> #221

Closed
Unbinilium opened this issue Jun 15, 2021 · 1 comment
Closed

[Feature request] Support multiple <meta name="theme-color"> #221

Unbinilium opened this issue Jun 15, 2021 · 1 comment

Comments

@Unbinilium
Copy link

Feature request

Description

For better user experience, the browser should get color hex before the page loaded, but it seems vuepress-next does not currently supported the duplicated meta tags like this:

['meta', { name: 'theme-color', content: '#3eaf7c', media: '(prefers-color-scheme: light)' }],
['meta', { name: 'theme-color', content: '#22272e', media: '(prefers-color-scheme: dark)' }],

Related with vuepress/ecosystem#7 and #218

Proposed Solution

We are using following snippet to dedupe <meta> tag:

https://github.com/vuepress/vuepress-next/blob/33c9a2145eeaf53429f2ae784e393074d1a9edd5/packages/%40vuepress/shared/src/utils/resolveHeadIdentifier.ts#L11-L14

But I think that supporting multiple <meta name="theme-color"> tags should be another issue.

There's another problem.

Meta tags set in user config will be injected to client with useSiteData. So we also have to update the sitedata ref, or the tag will be reset once navigating to another page.

Originally posted by @meteorlxy in #218 (comment)

@meteorlxy
Copy link
Member

meteorlxy commented Jun 15, 2021

According to the HTML Spec:

There must not be more than one meta element with its name attribute value set to an ASCII case-insensitive match for theme-color per document.

So this is a non-standard support of Safari 15.

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

2 participants