-
Notifications
You must be signed in to change notification settings - Fork 175
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
Added keys to tags in <Head> component #417
Changes from 1 commit
df8294f
3003a7e
cd7090a
4577772
50f9d78
78c1a5e
b925171
04f538e
cb6dfb2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ export function Meta({ title, tags }: MetaProps) { | |
return ( | ||
<Head> | ||
<link | ||
key="head_link_canonical" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's not prefix our key's with tldr; let's use |
||
rel="canonical" | ||
href={`${process.env.NEXT_PUBLIC_BASE_URL}${ | ||
router.asPath !== "/" ? router.asPath : "" | ||
|
@@ -35,17 +36,19 @@ export function Meta({ title, tags }: MetaProps) { | |
}) | ||
) : ( | ||
<> | ||
<title>{`${title} | Next.js for Drupal`}</title> | ||
<title key="head_title">{`${title} | Next.js for Drupal`}</title> | ||
<meta | ||
key="head_meta_description" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
name="description" | ||
content="A Next.js blog powered by a Drupal backend." | ||
/> | ||
<meta | ||
key="head_meta_og:image" | ||
property="og:image" | ||
content={`${process.env.NEXT_PUBLIC_BASE_URL}/images/meta.jpg`} | ||
/> | ||
<meta property="og:image:width" content="800" /> | ||
<meta property="og:image:height" content="600" /> | ||
<meta key="head_meta_og:image:width" property="og:image:width" content="800" /> | ||
<meta key="head_meta_og:image:height" property="og:image:height" content="600" /> | ||
</> | ||
)} | ||
</Head> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Next.js docs at https://nextjs.org/docs/pages/api-reference/components/head mention that key should be added so that:
It then shows an example of a meta tag not being duplicated. I think "meta tag" is what they meant by "tag" rather than "html tag".
If Next.js is adding duplicate title tags to the markup, then that's a Next.js bug. I don't think adding
key="head_title"
to our codebase makes any sense.