Skip to content

Commit

Permalink
fix: avoid over-normalising titleTemplate
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Nov 8, 2022
1 parent 973fe55 commit 675c019
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/zhead/src/normaliseTag.ts
Expand Up @@ -3,10 +3,12 @@ import { TagConfigKeys } from './constants'

export function normaliseTag<T extends HeadTag>(tagName: T['tag'], input: any): T | T[] {
const tag = { tag: tagName, props: {} } as T
if (tagName === 'title')
tag.children = String(input)
else
tag.props = normaliseProps({ ...input })
if (tagName === 'title' || tagName === 'titleTemplate') {
tag.children = input
return tag
}

tag.props = normaliseProps({ ...input })

;(['children', 'innerHtml', 'innerHTML'])
.forEach((key: string) => {
Expand Down

0 comments on commit 675c019

Please sign in to comment.