diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-template/index.js b/packages/edit-site/src/components/sidebar-navigation-screen-template/index.js index fd60d0a509ace2..e63b33ef169915 100644 --- a/packages/edit-site/src/components/sidebar-navigation-screen-template/index.js +++ b/packages/edit-site/src/components/sidebar-navigation-screen-template/index.js @@ -98,6 +98,11 @@ export default function SidebarNavigationScreenTemplate() { postId ); + // The absence of a post type in the query params for templates + // indicates the user has arrived at the template via the "manage all" + // page and the back button should return them to that list page. + const backPath = + postType !== 'wp_template' ? `/${ postType }/all` : `/${ postType }`; return ( { - navigator.goTo( `/${ postType }/all` ); + navigator.goTo( backPath ); } } /> { try { @@ -71,9 +74,7 @@ export default function TemplateActions( { sprintf( // translators: %s: The pattern's title e.g. 'Call to action'. __( '"%s" deleted.' ), - decodeEntities( - pattern?.title?.rendered || pattern?.title?.raw - ) + decodedTitle ), { type: 'snackbar', id: 'edit-site-patterns-success' } ); @@ -106,7 +107,7 @@ export default function TemplateActions( { sprintf( /* translators: The template/part's name. */ __( '"%s" reverted.' ), - decodeEntities( item.title.rendered ) + decodedTitle ), { type: 'snackbar', @@ -159,9 +160,7 @@ export default function TemplateActions( { onRemove?.(); onClose(); } } - title={ decodeEntities( - record.title.rendered || record.title.raw - ) } + title={ decodedTitle } /> ) }