mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Allow Duplicate Open Graph Image Tags (#4851)
* allow og:image duplicates * add tests * update tests * fix spacing
This commit is contained in:
parent
e8c1eaec83
commit
0f4e9feafa
|
@ -49,7 +49,7 @@ function onStateChange (head) {
|
|||
}
|
||||
|
||||
const METATYPES = ['name', 'httpEquiv', 'charSet', 'itemProp', 'property']
|
||||
const ALLOWED_DUPLICATES = ['article:tag']
|
||||
const ALLOWED_DUPLICATES = ['article:tag', 'og:image', 'og:image:alt', 'og:image:width', 'og:image:height', 'og:image:type', 'og:image:secure_url', 'og:image:url']
|
||||
|
||||
/*
|
||||
returns a function for filtering head child elements
|
||||
|
|
|
@ -15,6 +15,20 @@ export default () => <div>
|
|||
<meta property='article:tag' content='tag2' key='tag2key' />
|
||||
<meta property='dedupe:tag' content='tag3' key='tag3key' />
|
||||
<meta property='dedupe:tag' content='tag4' key='tag4key' />
|
||||
<meta property='og:image' content='ogImageTag1' key='ogImageTag1Key' />
|
||||
<meta property='og:image' content='ogImageTag2' key='ogImageTag2Key' />
|
||||
<meta property='og:image:alt' content='ogImageAltTag1' key='ogImageAltTag1Key' />
|
||||
<meta property='og:image:alt' content='ogImageAltTag2' key='ogImageAltTag2Key' />
|
||||
<meta property='og:image:width' content='ogImageWidthTag1' key='ogImageWidthTag1Key' />
|
||||
<meta property='og:image:width' content='ogImageWidthTag2' key='ogImageWidthTag2Key' />
|
||||
<meta property='og:image:height' content='ogImageHeightTag1' key='ogImageHeightTag1Key' />
|
||||
<meta property='og:image:height' content='ogImageHeightTag2' key='ogImageHeightTag2Key' />
|
||||
<meta property='og:image:type' content='ogImageTypeTag1' key='ogImageTypeTag1Key' />
|
||||
<meta property='og:image:type' content='ogImageTypeTag2' key='ogImageTypeTag2Key' />
|
||||
<meta property='og:image:secure_url' content='ogImageSecureUrlTag1' key='ogImageSecureUrlTag1Key' />
|
||||
<meta property='og:image:secure_url' content='ogImageSecureUrlTag2' key='ogImageSecureUrlTag2Key' />
|
||||
<meta property='og:image:url' content='ogImageUrlTag1' key='ogImageUrlTag1Key' />
|
||||
<meta property='og:image:url' content='ogImageUrlTag2' key='ogImageUrlTag2Key' />
|
||||
|
||||
<React.Fragment>
|
||||
<title>Fragment title</title>
|
||||
|
|
|
@ -49,6 +49,20 @@ export default function ({ app }, suiteName, render, fetch) {
|
|||
expect(html).toContain('<meta property="article:tag" content="tag2" class="next-head"/>')
|
||||
expect(html).not.toContain('<meta property="dedupe:tag" content="tag3" class="next-head"/>')
|
||||
expect(html).toContain('<meta property="dedupe:tag" content="tag4" class="next-head"/>')
|
||||
expect(html).toContain('<meta property="og:image" content="ogImageTag1" class="next-head"/>')
|
||||
expect(html).toContain('<meta property="og:image" content="ogImageTag2" class="next-head"/>')
|
||||
expect(html).toContain('<meta property="og:image:alt" content="ogImageAltTag1" class="next-head"/>')
|
||||
expect(html).toContain('<meta property="og:image:alt" content="ogImageAltTag2" class="next-head"/>')
|
||||
expect(html).toContain('<meta property="og:image:width" content="ogImageWidthTag1" class="next-head"/>')
|
||||
expect(html).toContain('<meta property="og:image:width" content="ogImageWidthTag2" class="next-head"/>')
|
||||
expect(html).toContain('<meta property="og:image:height" content="ogImageHeightTag1" class="next-head"/>')
|
||||
expect(html).toContain('<meta property="og:image:height" content="ogImageHeightTag2" class="next-head"/>')
|
||||
expect(html).toContain('<meta property="og:image:type" content="ogImageTypeTag1" class="next-head"/>')
|
||||
expect(html).toContain('<meta property="og:image:type" content="ogImageTypeTag2" class="next-head"/>')
|
||||
expect(html).toContain('<meta property="og:image:secure_url" content="ogImageSecureUrlTag1" class="next-head"/>')
|
||||
expect(html).toContain('<meta property="og:image:secure_url" content="ogImageSecureUrlTag2" class="next-head"/>')
|
||||
expect(html).toContain('<meta property="og:image:url" content="ogImageUrlTag1" class="next-head"/>')
|
||||
expect(html).toContain('<meta property="og:image:url" content="ogImageUrlTag2" class="next-head"/>')
|
||||
})
|
||||
|
||||
test('header helper renders Fragment children', async () => {
|
||||
|
|
Loading…
Reference in a new issue