diff --git a/docs/reference-guides/core-blocks.md b/docs/reference-guides/core-blocks.md index dd49d156857249..dd28747d5f02ec 100644 --- a/docs/reference-guides/core-blocks.md +++ b/docs/reference-guides/core-blocks.md @@ -775,7 +775,7 @@ Display the query title. ([Source](https://github.com/WordPress/gutenberg/tree/t - **Name:** core/query-title - **Category:** theme - **Supports:** align (full, wide), color (background, gradients, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** level, levelOptions, showPrefix, showSearchTerm, textAlign, type +- **Attributes:** blogTitle, level, levelOptions, showPrefix, showSearchTerm, textAlign, type ## Quote diff --git a/packages/block-library/src/query-title/block.json b/packages/block-library/src/query-title/block.json index 5d5c9113bda084..5f539702bc4297 100644 --- a/packages/block-library/src/query-title/block.json +++ b/packages/block-library/src/query-title/block.json @@ -27,6 +27,10 @@ "showSearchTerm": { "type": "boolean", "default": true + }, + "blogTitle": { + "type": "string", + "default": "Blog" } }, "example": { diff --git a/packages/block-library/src/query-title/edit.js b/packages/block-library/src/query-title/edit.js index 21d23081837cdf..d459f5ac4efe40 100644 --- a/packages/block-library/src/query-title/edit.js +++ b/packages/block-library/src/query-title/edit.js @@ -22,7 +22,7 @@ import { __, _x, sprintf } from '@wordpress/i18n'; */ import { useArchiveLabel } from './use-archive-label'; -const SUPPORTED_TYPES = [ 'archive', 'search' ]; +const SUPPORTED_TYPES = [ 'archive', 'search', 'blog' ]; export default function QueryTitleEdit( { attributes: { @@ -32,10 +32,14 @@ export default function QueryTitleEdit( { textAlign, showPrefix, showSearchTerm, + blogTitle, }, setAttributes, } ) { const { archiveTypeLabel, archiveNameLabel } = useArchiveLabel(); + const currentTemplate = useSelect( ( select ) => { + return select( coreStore )?.getEditedPostType(); + } ); const TagName = `h${ level }`; const blockProps = useBlockProps( { @@ -44,7 +48,10 @@ export default function QueryTitleEdit( { } ), } ); - if ( ! SUPPORTED_TYPES.includes( type ) ) { + if ( + ! SUPPORTED_TYPES.includes( type ) && + ! [ 'index', 'home' ].includes( currentTemplate ) + ) { return (