-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Query Title: add Search and 404 page titles #33515
Closed
Closed
Changes from all commits
Commits
Show all changes
54 commits
Select commit
Hold shift + click to select a range
1744a97
Add Archive Title block
ntsekouras a6ceb90
remove extra lines
ntsekouras 03b2704
convert to int
ntsekouras 47aae1b
Add new ArchiveTitle icon
ntsekouras 00d949f
query title with block variations
ntsekouras 3b694a9
Merge branch 'trunk' into try/archive-title
mikachan 82ec6c7
Fix merge errors
mikachan b2fb7d7
Add support for search in query title
mikachan 258dc44
Add support for 404 in query title
mikachan 4ebfe53
Merge branch 'WordPress:trunk' into add/search-404-titles
mikachan be5836c
Remove translators comment for 404 title
mikachan 9dd89e5
Merge branch 'WordPress:trunk' into add/search-404-titles
mikachan 900c95b
Remove subhead from block folders array
mikachan 7e3f308
Add another wording option for search title
mikachan 3244717
Reformat type if statement
mikachan 22d458d
Add context to 404 template title
mikachan 08da5a2
Merge branch 'WordPress:trunk' into add/search-404-titles
mikachan 1f40aca
Add icons to search and 404 title blocks
mikachan ecdd94b
Remove Query Title variations
mikachan 600204c
Remove type attribute from Query Title
mikachan ff7179c
Add templateSlug context to Query Title
mikachan 0e17396
Change Query Title content relative to templateSlug context
mikachan fb20f58
Refactor title content variable
mikachan a571c6f
Use _x function for archive title
mikachan ad39fe9
Add supported templates list; display warning if template is not yet …
mikachan 2420657
Add comment to useEffect
mikachan 3fa11cc
Add alternative option for search results title
mikachan 9ca7923
Merge branch 'WordPress:trunk' into add/search-404-titles
mikachan e02f72d
Add archive title icon for Query Title
mikachan a527d24
Remove alternative search title
mikachan 5845908
Use RichText for search title
mikachan 710759e
Add more detail to Query Title description
mikachan 018dbb0
Don't output anything when the title isn't set
scruffian 38b7675
typo fix
scruffian cf5f3e5
Update comment
scruffian 64738dc
Fix query title unit test
mikachan 9ca257a
Remove Query title placeholder text
mikachan ca7498c
Move empty title check further down
mikachan b2ebbc8
Format equals sign alignment
mikachan 5e0eef7
Change if to elseif in Query Title index.php
mikachan 9ed105b
Remove content from archive title block
mikachan 152103b
Change default content to 'Query title'
mikachan 358cb81
Add __unstableMarkNextChangeAsNotPersistent to useEffect
mikachan b5b52a8
Add searchTitleContent & nothingFoundTitleContent attributes
mikachan 9df71fa
Add InspectorControls for title variations
mikachan b1c26ae
Simplify title variable names
mikachan 5d37503
Remove RichText import
mikachan 91b79cd
Change placeholder title to 'Query title placeholder'
mikachan ca655a2
Remove default placeholder
mikachan b88c5de
Remove content attribute
mikachan cc02de1
Remove Inspector Controls
mikachan 6ccbdad
Remove content attribute from block test
mikachan 9f15ae5
Add default state for index template in editor
mikachan eff88a8
Remove title variable based on content attribute
mikachan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { archiveTitle as icon } from '@wordpress/icons'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import metadata from './block.json'; | ||
import edit from './edit'; | ||
import variations from './variations'; | ||
|
||
const { name } = metadata; | ||
export { metadata, name }; | ||
|
||
export const settings = { | ||
icon, | ||
edit, | ||
variations, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems hacky to me 😄 . We use React's implementation details to update the content after the first render and by updating the
content
attribute, we also create anundo
level in history. That's one of the reasons I had block variations in mind back then. Thephp
handling remains the same, the abovecontent
attribute handling is done by the variations and we can provide a bit more specific info for the block (BlockCard etc..).An alternative, if this approach is preferred, is to use
__unstableMarkNextChangeAsNotPersistent
here and a new variable for thefirst content
(to avoid changing the existingcontent
var).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha I wasn't sure where else to turn so I jumped to
useEffect
! Thanks so much for the detailed explanation.As soon as I moved this logic from the variations file to edit.js, I could see the advantage of using variations. However, as @scruffian has just mentioned above, I think the advantage to not using variations is that the user (or a theme) only needs to insert one block, and the block works the content out itself based on context (i.e. the template).
With that in mind, I'm going to attempt your suggested alternative. Thanks for the suggestion and input, it's really helped me understand this more.