diff --git a/src/node/build/render.ts b/src/node/build/render.ts index 40675408..a3079903 100644 --- a/src/node/build/render.ts +++ b/src/node/build/render.ts @@ -152,7 +152,11 @@ export async function renderPage( - + ${ + isMetaViewportOverridden(head) + ? '' + : '' + } ${title} ${stylesheetLink} @@ -248,11 +252,14 @@ function renderAttrs(attrs: Record): string { .join('') } -function isMetaDescription(headConfig: HeadConfig) { - const [type, attrs] = headConfig - return type === 'meta' && attrs?.name === 'description' +function filterOutHeadDescription(head: HeadConfig[] = []) { + return head.filter(([type, attrs]) => { + return !(type === 'meta' && attrs?.name === 'description') + }) } -function filterOutHeadDescription(head: HeadConfig[] | undefined) { - return head ? head.filter((h) => !isMetaDescription(h)) : [] +function isMetaViewportOverridden(head: HeadConfig[] = []) { + return head.some(([type, attrs]) => { + return type === 'meta' && attrs?.name === 'viewport' + }) }