|
|
@ -152,7 +152,11 @@ export async function renderPage(
|
|
|
|
<html lang="${siteData.lang}" dir="${siteData.dir}">
|
|
|
|
<html lang="${siteData.lang}" dir="${siteData.dir}">
|
|
|
|
<head>
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
|
|
${
|
|
|
|
|
|
|
|
isMetaViewportOverridden(head)
|
|
|
|
|
|
|
|
? ''
|
|
|
|
|
|
|
|
: '<meta name="viewport" content="width=device-width,initial-scale=1">'
|
|
|
|
|
|
|
|
}
|
|
|
|
<title>${title}</title>
|
|
|
|
<title>${title}</title>
|
|
|
|
<meta name="description" content="${description}">
|
|
|
|
<meta name="description" content="${description}">
|
|
|
|
${stylesheetLink}
|
|
|
|
${stylesheetLink}
|
|
|
@ -248,11 +252,14 @@ function renderAttrs(attrs: Record<string, string>): string {
|
|
|
|
.join('')
|
|
|
|
.join('')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function isMetaDescription(headConfig: HeadConfig) {
|
|
|
|
function filterOutHeadDescription(head: HeadConfig[] = []) {
|
|
|
|
const [type, attrs] = headConfig
|
|
|
|
return head.filter(([type, attrs]) => {
|
|
|
|
return type === 'meta' && attrs?.name === 'description'
|
|
|
|
return !(type === 'meta' && attrs?.name === 'description')
|
|
|
|
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function filterOutHeadDescription(head: HeadConfig[] | undefined) {
|
|
|
|
function isMetaViewportOverridden(head: HeadConfig[] = []) {
|
|
|
|
return head ? head.filter((h) => !isMetaDescription(h)) : []
|
|
|
|
return head.some(([type, attrs]) => {
|
|
|
|
|
|
|
|
return type === 'meta' && attrs?.name === 'viewport'
|
|
|
|
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|