Skip to content

Commit

Permalink
Site Editor: Append template type and name to the site editor page ti…
Browse files Browse the repository at this point in the history
…tle (#47855)
  • Loading branch information
glendaviesnz authored Feb 9, 2023
1 parent bb6ddd7 commit 417ecc1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/edit-site/src/components/editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,20 @@ export default function Editor() {
);
const isReady = editedPostType !== undefined && editedPostId !== undefined;

let title;
if ( isReady && editedPost ) {
const type =
editedPostType === 'wp_template'
? __( 'Template' )
: __( 'Template Part' );
title = `${ editedPost.title?.rendered }${ type }${ __(
'Editor (beta)'
) }`;
}

// Only announce the title once the editor is ready to prevent "Replace"
// action in <URlQueryController> from double-announcing.
useTitle( isReady && __( 'Editor (beta)' ) );
useTitle( isReady && title );

if ( ! isReady ) {
return <CanvasSpinner />;
Expand Down

0 comments on commit 417ecc1

Please sign in to comment.