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
Steps to reproduce the behavior, please provide code snippets or a repository:
<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">
It looks like this used to work. We're using Swiftype meta tags to let our site be crawled but upgrading from 9.1.4 to 9.1.5 has broken (changed?) this behaviour.
const categories = ['foo', 'bar']
<Head>
{ categories.map(category => (
<meta name="category" content={category} key={category} />
))}
</Head>
In 9.1.4, you get
<meta name="category" content="foo"></meta>
<meta name="category" content="bar"></meta>
In 9.1.5 +, you get
<meta name="category" content="bar"></meta>
Is this use case supposed to be supported? I'm not 100% clear whether this is a regression or not. Based on #9315 it looks like it should be supported.
Apologies for my delayed response. It should work because lot of scholar based tags are used as such.
Examples:
https://appliedcr.biomedcentral.com/articles/10.1186/s41241-020-00085-y
<meta name="citation_reference" content="citation_journal_title=Oral Oncol; citation_title=Predictive factors of occult metastasis and prognosis of clinical stages I and II squamous cell carcinoma of the tongue and floor of the mouth; citation_author=TM Pimenta Amaral, AR Silva Freire, AL Carvalho, CA Pinto, LP Kowalski; citation_volume=40; citation_issue=8; citation_publication_date=2004; citation_pages=780-786; citation_doi=10.1016/j.oraloncology.2003.10.009; citation_id=CR2"/>
<meta name="citation_reference" content="citation_journal_title=Oral Oncol; citation_title=Increase in head and neck cancer in younger patients due to human papillomavirus (HPV); citation_author=D Young, CC Xiao, B Murphy, M Moore, C Fakhry, TA Day; citation_volume=51; citation_issue=8; citation_publication_date=2015; citation_pages=727-730; citation_doi=10.1016/j.oraloncology.2015.03.015; citation_id=CR3"/>
<meta name="citation_reference" content="citation_journal_title=Int J Exp Pathol; citation_title=Molecular predictors of clinical outcome in patients with head and neck squamous cell carcinoma; citation_author=GR Thomas, H Nadiminti, J Regalado; citation_volume=86; citation_issue=6; citation_publication_date=2005; citation_pages=347-363; citation_doi=10.1111/j.0959-9673.2005.00447.x; citation_id=CR4"/>
https://link.springer.com/article/10.1007/s10528-020-09951-4
https://www.academia.edu/42258245/AtCDC5_regulates_the_G2_to_M_transition_of_the_cell_cycle_and_is_critical_for_the_function_of_Arabidopsis_shoot_apical_meristem
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:
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.
Is there a workaround for this?
We are facing the same issue in OpenReview: https://openreview.net/forum?id=HygBZnRctX
Google Scholar is using these meta tags to read the paper metadata.
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
keyprops are provided we should be able to override this behavior and output multiple tags with the sameMETATYPES.
I agree with @justin-schroeder that this should be the default behavior.
Most helpful comment
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 agree with @justin-schroeder that this should be the default behavior.