question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't provide multiple meta tags with the same name

See original GitHub issue

Bug report

Describe the bug

Ability to support multiple meta tags with same name. I see that there was an effort to support multiple meta tags with same property in https://github.com/zeit/next.js/pull/5800 but this still doesn’t allow multiple meta tags with same name. This is useful to supporting “citation_author” for SEO indexing in Google Scholar https://scholar.google.com/intl/en-us/scholar/inclusion.html#indexing

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Provide multiple meta tags with the same name in <Head>
  2. Check the output

Expected behavior

<meta name="citation_author" content="Rannels, Stephen R."> <meta name="citation_author" content="Falconieri, Mary">

should give markup as such but, currently it produces

<meta name="citation_author" content="Falconieri, Mary">

System information

  • Version of Next.js: 9.1.6

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
zbialeckicommented, Aug 18, 2020

I have created a minimal test case for this issue: https://github.com/zbialecki/next-meta-tag-issue

I verified that it is still present in Next.js v9.5.3-canary.9, both in dev and production mode.

I would suggest that if unique key props are provided we should be able to override this behavior and output multiple tags with the same METATYPES.

I agree with @justin-schroeder that this should be the default behavior.

2reactions
justin-schroedercommented, May 26, 2020

Same issue, we’re also struggling to get multi-value meta tags indexed by Swiftype which uses this exact mechanism. The next/head code makes it clear why this is happening:

https://github.com/zeit/next.js/blob/86160a5190c50ea315c7ba91d77dfb51c42bc65f/packages/next/next-server/lib/head.tsx#L50-L103

I think this is actually the correct default behavior since duplicate meta tags is a real pain that is solved here. I would suggest that if unique key props are provided we should be able to override this behavior and output multiple tags with the same METATYPES.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multiple <meta> Tags with the Same Name - Stack Overflow
Using multiple meta tags with the same name is valid HTML. ... Either two meta tags will be concatenated or one of them...
Read more >
Can a web page have two keyword meta tags?
Yes. If only one meta element with the keywords name would be allowed, the spec would restrict it, like it does with the...
Read more >
Google on How it Handles Extra Meta Descriptions and Title ...
According to Google, Google will combine extra title and meta description tags into a single meta description and a single title tag. But...
Read more >
Why Duplicate Meta Titles and Descriptions Hurt Your Site
If you have more than one page on your website with the same meta title or meta description they are actually diluting your...
Read more >
Meta Tags and Attributes that Google Supports | Documentation
The <meta name="robots" ... tag applies to all search engines, while the <meta name="googlebot ... tag is specific to Google. In the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found