diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-pages/index.js b/packages/edit-site/src/components/sidebar-navigation-screen-pages/index.js
index 567bf91aca69f..331221dde7985 100644
--- a/packages/edit-site/src/components/sidebar-navigation-screen-pages/index.js
+++ b/packages/edit-site/src/components/sidebar-navigation-screen-pages/index.js
@@ -58,13 +58,16 @@ export default function SidebarNavigationScreenPages() {
templates?.find( ( template ) => template.slug === 'home' ) ||
templates?.find( ( template ) => template.slug === 'index' );
+ const getPostsPageTemplate = () =>
+ templates?.find( ( template ) => template.slug === 'home' ) ||
+ templates?.find( ( template ) => template.slug === 'index' );
+
const pagesAndTemplates = pages?.concat( dynamicPageTemplates, [
homeTemplate,
] );
const { frontPage, postsPage } = useSelect( ( select ) => {
const { getEntityRecord } = select( coreStore );
-
const siteSettings = getEntityRecord( 'root', 'site' );
return {
frontPage: siteSettings?.page_on_front,
@@ -106,6 +109,27 @@ export default function SidebarNavigationScreenPages() {
setShowAddPage( false );
};
+ const getPageProps = ( id ) => {
+ let itemIcon = page;
+ const postsPageTemplateId =
+ postsPage && postsPage === id ? getPostsPageTemplate()?.id : null;
+
+ switch ( id ) {
+ case frontPage:
+ itemIcon = home;
+ break;
+ case postsPage:
+ itemIcon = verse;
+ break;
+ }
+
+ return {
+ icon: itemIcon,
+ postType: postsPageTemplateId ? 'wp_template' : 'page',
+ postId: postsPageTemplateId || id,
+ };
+ };
+
return (
<>
{ showAddPage && (
@@ -152,34 +176,20 @@ export default function SidebarNavigationScreenPages() {
) }
- { reorderedPages?.map( ( item ) => {
- let itemIcon;
- switch ( item.id ) {
- case frontPage:
- itemIcon = home;
- break;
- case postsPage:
- itemIcon = verse;
- break;
- default:
- itemIcon = page;
- }
- return (
-
-
- { decodeEntities(
- item?.title?.rendered ||
- __( '(no title)' )
- ) }
-
-
- );
- } ) }
+ { reorderedPages?.map( ( { id, title } ) => (
+
+
+ { decodeEntities(
+ title?.rendered ||
+ __( '(no title)' )
+ ) }
+
+
+ ) ) }
) }
>