File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -602,17 +602,17 @@ export const getExistingTag = async ( module ) => {
602
602
// Add a timestamp for cache-busting.
603
603
timestamp : Date . now ( ) ,
604
604
} ;
605
- let tagFound ;
606
605
607
- if ( 'secondary' === ampMode ) {
606
+ // Always check the homepage regardless of AMP mode.
607
+ let tagFound = await scrapeTag ( addQueryArgs ( homeURL , tagFetchQueryArgs ) , module ) ;
608
+
609
+ if ( ! tagFound && 'secondary' === ampMode ) {
608
610
tagFound = await apiFetch ( { path : '/wp/v2/posts?per_page=1' } ) . then (
609
611
// Scrape the first post in AMP mode, if there is one.
610
612
( posts ) => posts . slice ( 0 , 1 ) . map ( async ( post ) => {
611
613
return await scrapeTag ( addQueryArgs ( post . link , { ...tagFetchQueryArgs , amp : 1 } ) , module ) ;
612
614
} ) . pop ( )
613
615
) ;
614
- } else {
615
- tagFound = await scrapeTag ( addQueryArgs ( homeURL , tagFetchQueryArgs ) , module ) ;
616
616
}
617
617
618
618
return Promise . resolve ( tagFound || null ) ;
You can’t perform that action at this time.
0 commit comments