@@ -206,9 +206,11 @@ async function checkSoft404() {
206206// === 3. SEO メタタグ ===
207207async function checkMeta ( ) {
208208 const r = await fetchFollow ( "/" ) ;
209- const ogLocale = / (?: p r o p e r t y | n a m e ) = [ " ' ] o g : l o c a l e [ " ' ] [ ^ > ] * c o n t e n t = [ " ' ] j a _ J P [ " ' ] / i. test ( r . body ) ||
209+ const ogLocale =
210+ / (?: p r o p e r t y | n a m e ) = [ " ' ] o g : l o c a l e [ " ' ] [ ^ > ] * c o n t e n t = [ " ' ] j a _ J P [ " ' ] / i. test ( r . body ) ||
210211 / c o n t e n t = [ " ' ] j a _ J P [ " ' ] [ ^ > ] * (?: p r o p e r t y | n a m e ) = [ " ' ] o g : l o c a l e [ " ' ] / i. test ( r . body ) ;
211- const twitterSite = / n a m e = [ " ' ] t w i t t e r : s i t e [ " ' ] [ ^ > ] * c o n t e n t = [ " ' ] @ [ ^ " ' ] + [ " ' ] / i. test ( r . body ) ||
212+ const twitterSite =
213+ / n a m e = [ " ' ] t w i t t e r : s i t e [ " ' ] [ ^ > ] * c o n t e n t = [ " ' ] @ [ ^ " ' ] + [ " ' ] / i. test ( r . body ) ||
212214 / c o n t e n t = [ " ' ] @ [ ^ " ' ] + [ " ' ] [ ^ > ] * n a m e = [ " ' ] t w i t t e r : s i t e [ " ' ] / i. test ( r . body ) ;
213215 record ( "META" , "og:locale=ja_JP" , ogLocale , ogLocale ? "found" : "missing on /" ) ;
214216 record ( "META" , "twitter:site" , twitterSite , twitterSite ? "found" : "missing on /" ) ;
@@ -229,7 +231,8 @@ async function checkNoImage() {
229231 record ( "NO_IMAGE" , path , false , `article not reachable (status=${ r . status } )` ) ;
230232 continue ;
231233 }
232- const broken = r . body . includes ( "+/images/no-image.svg" ) ||
234+ const broken =
235+ r . body . includes ( "+/images/no-image.svg" ) ||
233236 r . body . includes ( "%2B/images/no-image.svg" ) ||
234237 r . body . includes ( "+%2Fimages%2Fno-image.svg" ) ;
235238 record ( "NO_IMAGE" , path , ! broken , broken ? "found broken `+/images/no-image.svg`" : "ok" ) ;
@@ -239,7 +242,8 @@ async function checkNoImage() {
239242// === 5. 認可ガード ===
240243async function checkAuth ( ) {
241244 const admin = await fetchManual ( "/admin" ) ;
242- const adminOk = ( admin . status === 302 || admin . status === 303 || admin . status === 307 ) &&
245+ const adminOk =
246+ ( admin . status === 302 || admin . status === 303 || admin . status === 307 ) &&
243247 / \/ l o g i n / . test ( admin . location ?? "" ) ;
244248 record (
245249 "AUTH" ,
@@ -281,7 +285,9 @@ async function checkSitemapSamples() {
281285 const buckets : Record < string , string [ ] > = { } ;
282286 for ( const p of allPaths ) {
283287 const key = p . split ( "/" ) . slice ( 0 , 3 ) . join ( "/" ) || "/" ;
284- ( buckets [ key ] ??= [ ] ) . push ( p ) ;
288+ const bucket = buckets [ key ] ?? [ ] ;
289+ bucket . push ( p ) ;
290+ buckets [ key ] = bucket ;
285291 }
286292 const sampled : string [ ] = [ ] ;
287293 for ( const paths of Object . values ( buckets ) ) {
@@ -299,7 +305,9 @@ async function checkSitemapSamples() {
299305 continue ;
300306 }
301307 if ( r . status === 301 || r . status === 308 ) {
302- const followUrl = r . location ?. startsWith ( "http" ) ? r . location : `${ NEW_BASE } ${ r . location ?? "" } ` ;
308+ const followUrl = r . location ?. startsWith ( "http" )
309+ ? r . location
310+ : `${ NEW_BASE } ${ r . location ?? "" } ` ;
303311 try {
304312 const followed = await fetch ( followUrl , { redirect : "follow" } ) ;
305313 if ( followed . ok ) {
@@ -319,9 +327,16 @@ async function checkSitemapSamples() {
319327 }
320328
321329 const detail = `${ pass } /${ sampled . length } reachable${
322- failed . length > 0 ? `\n - ${ failed . slice ( 0 , 20 ) . join ( "\n - " ) } ${ failed . length > 20 ? `\n - ... (${ failed . length - 20 } more)` : "" } ` : ""
330+ failed . length > 0
331+ ? `\n - ${ failed . slice ( 0 , 20 ) . join ( "\n - " ) } ${ failed . length > 20 ? `\n - ... (${ failed . length - 20 } more)` : "" } `
332+ : ""
323333 } `;
324- record ( "SITEMAP_SAMPLE" , `${ sampled . length } URLs across ${ Object . keys ( buckets ) . length } buckets` , fail === 0 , detail ) ;
334+ record (
335+ "SITEMAP_SAMPLE" ,
336+ `${ sampled . length } URLs across ${ Object . keys ( buckets ) . length } buckets` ,
337+ fail === 0 ,
338+ detail ,
339+ ) ;
325340}
326341
327342async function main ( ) {
0 commit comments