diff --git a/lib/head.js b/lib/head.js
index 6c45f21b240ed4eba3b094f3f525dd8154485289..5afbb8f6dd97f07d1d593df19a41f7ffd5d6a46f 100644
--- a/lib/head.js
+++ b/lib/head.js
@@ -49,9 +49,13 @@ function onStateChange (head) {
}
const METATYPES = ['name', 'httpEquiv', 'charSet', 'itemProp', 'property']
+const ALLOWED_DUPLICATES = ['article:tag']
-// returns a function for filtering head child elements
-// which shouldn't be duplicated, like
.
+/*
+ returns a function for filtering head child elements
+ which shouldn't be duplicated, like ,
+ except we explicit allow it in ALLOWED_DUPLICATES array
+*/
function unique () {
const keys = new Set()
@@ -81,7 +85,7 @@ function unique () {
} else {
const category = h.props[metatype]
const categories = metaCategories[metatype] || new Set()
- if (categories.has(category)) return false
+ if (categories.has(category) && ALLOWED_DUPLICATES.indexOf(category) === -1) return false
categories.add(category)
metaCategories[metatype] = categories
}
diff --git a/test/integration/basic/pages/head.js b/test/integration/basic/pages/head.js
index b344c695e66eeb82aaef9d103b36fc62cf4fcf7b..05bc13e9b8a70c26593eccea8e71e4b1aae2597b 100644
--- a/test/integration/basic/pages/head.js
+++ b/test/integration/basic/pages/head.js
@@ -10,6 +10,12 @@ export default () =>
+ {/* allow duplicates for specific tags */}
+
+
+
+
+
Fragment title
diff --git a/test/integration/basic/test/rendering.js b/test/integration/basic/test/rendering.js
index 92d8e3110b051ca8ba28a0c8cea27a3865ebc866..b57b8fad7f03023cb48e8ab3f80de686a450c902 100644
--- a/test/integration/basic/test/rendering.js
+++ b/test/integration/basic/test/rendering.js
@@ -43,6 +43,14 @@ export default function ({ app }, suiteName, render, fetch) {
expect(html).not.toContain('')
})
+ test('header helper avoids dedupe of specific tags', async () => {
+ const html = await (render('/head'))
+ expect(html).toContain('')
+ expect(html).toContain('')
+ expect(html).not.toContain('')
+ expect(html).toContain('')
+ })
+
test('header helper renders Fragment children', async () => {
const html = await (render('/head'))
expect(html).toContain('Fragment title')