File tree 1 file changed +21
-10
lines changed
packages/gatsby/cache-dir/head
1 file changed +21
-10
lines changed Original file line number Diff line number Diff line change @@ -56,20 +56,31 @@ export function headHandlerForSSR({
56
56
57
57
const seenIds = new Map ( )
58
58
for ( const node of headNodes ) {
59
- const { rawTagName, attributes } = node
60
- const id = attributes . id
59
+ const { rawTagName } = node
60
+ const id = node . attributes . id
61
61
62
62
if ( ! VALID_NODE_NAMES . includes ( rawTagName ) ) {
63
63
warnForInvalidTags ( rawTagName )
64
64
} else {
65
- const element = createElement (
66
- rawTagName ,
67
- {
68
- ...attributes ,
69
- "data-gatsby-head" : true ,
70
- } ,
71
- node . childNodes [ 0 ] ?. textContent
72
- )
65
+ let element
66
+ const attributes = { ...node . attributes , "data-gatsby-head" : true }
67
+ if ( rawTagName === `script` ) {
68
+ element = (
69
+ < script
70
+ { ...attributes }
71
+ dangerouslySetInnerHTML = { {
72
+ __html : node . text ,
73
+ } }
74
+ />
75
+ )
76
+ } else {
77
+ element = (
78
+ < node . rawTagName { ...attributes } >
79
+ { node . childNodes [ 0 ] ?. textContent }
80
+ </ node . rawTagName >
81
+ )
82
+ }
83
+
73
84
if ( id ) {
74
85
if ( ! seenIds . has ( id ) ) {
75
86
validHeadNodes . push ( element )
You can’t perform that action at this time.
0 commit comments