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

Add media property to MetaTag interface #1181

Open
kaje94 opened this issue Mar 1, 2023 · 1 comment
Open

Add media property to MetaTag interface #1181

kaje94 opened this issue Mar 1, 2023 · 1 comment

Comments

@kaje94
Copy link

kaje94 commented Mar 1, 2023

Is your feature request related to a problem? Please describe.
I'm trying to provide a theme-color meta tag for both dark theme as well as light theme. The standard themeColor prop only works with light theme.

Describe the solution you'd like
Add a media property to MetaTag interface so that users can define the content of the meta tag based on media property.

The meta tag added to html head would look something like this

<meta content="#FFFFFF"  name="theme-color" media="(prefers-color-scheme: dark)" />

Describe alternatives you've considered
adding darkThemeColor property to DefaultSeoProps might also work but it will only handle this particular use case

@ilyaliao
Copy link

ilyaliao commented Dec 24, 2023

If you use next-themes, try this.

import { useTheme } from 'next-themes';
const { resolvedTheme } = useTheme();

<NextSeo
  themeColor={resolvedTheme === 'dark' ? darkColor : lightColor}
/>

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

No branches or pull requests

2 participants