File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed
Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -152,7 +152,11 @@ export async function renderPage(
152152<html lang="${ siteData . lang } " dir="${ siteData . dir } ">
153153 <head>
154154 <meta charset="utf-8">
155- <meta name="viewport" content="width=device-width,initial-scale=1">
155+ ${
156+ isMetaViewportOverridden ( head )
157+ ? ''
158+ : '<meta name="viewport" content="width=device-width,initial-scale=1">'
159+ }
156160 <title>${ title } </title>
157161 <meta name="description" content="${ description } ">
158162 ${ stylesheetLink }
@@ -248,11 +252,14 @@ function renderAttrs(attrs: Record<string, string>): string {
248252 . join ( '' )
249253}
250254
251- function isMetaDescription ( headConfig : HeadConfig ) {
252- const [ type , attrs ] = headConfig
253- return type === 'meta' && attrs ?. name === 'description'
255+ function filterOutHeadDescription ( head : HeadConfig [ ] = [ ] ) {
256+ return head . filter ( ( [ type , attrs ] ) => {
257+ return ! ( type === 'meta' && attrs ?. name === 'description' )
258+ } )
254259}
255260
256- function filterOutHeadDescription ( head : HeadConfig [ ] | undefined ) {
257- return head ? head . filter ( ( h ) => ! isMetaDescription ( h ) ) : [ ]
261+ function isMetaViewportOverridden ( head : HeadConfig [ ] = [ ] ) {
262+ return head . some ( ( [ type , attrs ] ) => {
263+ return type === 'meta' && attrs ?. name === 'viewport'
264+ } )
258265}
You can’t perform that action at this time.
0 commit comments