File tree 1 file changed +13
-6
lines changed
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(
152
152
<html lang="${ siteData . lang } " dir="${ siteData . dir } ">
153
153
<head>
154
154
<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
+ }
156
160
<title>${ title } </title>
157
161
<meta name="description" content="${ description } ">
158
162
${ stylesheetLink }
@@ -248,11 +252,14 @@ function renderAttrs(attrs: Record<string, string>): string {
248
252
. join ( '' )
249
253
}
250
254
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
+ } )
254
259
}
255
260
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
+ } )
258
265
}
You can’t perform that action at this time.
0 commit comments