Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
0f4e9fea
Commit
0f4e9fea
authored
Aug 12, 2018
by
Gary Meehan
Committed by
Tim Neutkens
Aug 12, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow Duplicate Open Graph Image Tags (#4851)
* allow og:image duplicates * add tests * update tests * fix spacing
parent
e8c1eaec
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
1 deletion
+29
-1
head.js
lib/head.js
+1
-1
head.js
test/integration/basic/pages/head.js
+14
-0
rendering.js
test/integration/basic/test/rendering.js
+14
-0
No files found.
lib/head.js
View file @
0f4e9fea
...
...
@@ -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
...
...
test/integration/basic/pages/head.js
View file @
0f4e9fea
...
...
@@ -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
>
...
...
test/integration/basic/test/rendering.js
View file @
0f4e9fea
...
...
@@ -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
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment