Skip to content
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

Post Template: add no results message on frontend #38437

Closed
wants to merge 2 commits into from

Conversation

ramonjd
Copy link
Member

@ramonjd ramonjd commented Feb 2, 2022

Description

Adds a "__( 'No results found.' ) string to the post template frontend where no posts are returned from the query.

❗ This is a PR in waiting: that is, it's in a holding pattern until we come up with a plan to make the "no results" view configurable. It might be a good idea to add content here, it probably isn't.

🤔 Having a piece of text that isn't editable show up might not be in the spirit of the block editor, and it might be best to wait until we deliver an editable solution.

Testing Instructions

Empty your site of all posts and pull up an archive page, or any query-based post using the Post Template Block.

Or search for http://localhost:4759/?s=where+is+my+coffee%3F

Screen Shot 2022-02-02 at 7 12 22 pm

Types of changes

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).
  • I've updated related schemas if appropriate.

@ramonjd ramonjd added [Status] In Progress Tracking issues with work in progress [Type] Question Questions about the design or development of the editor. labels Feb 2, 2022
@carolinan
Copy link
Contributor

carolinan commented Feb 2, 2022

Duplicate of #36225

I have been thinking about how to make it configurable quiet a lot this week even tried a few different things.
Some difficulties:
if we picture the "no results" as a container for other blocks so that the message can be customized:

  • A "no results" block needs to be available (placeable) in the editor even if there are results displaying in the editor,
    since the result on the front can depend on the query blocks "inherit from template" setting.
  • The no results block should not be repeated, and not placed inside the list element of the post template.
  • What inner blocks should be available for a no results block? What do users need, to be able to create a good no results found message?
    Perhaps all blocks should be available, including a second query block? (picture ecommerce sites that want to display other results if the first returns nothing.)

It is not always suitable to display this message if there is more than one query on a page.
If there is a strong need for solve this temporarily, I would suggest making the message optional, perhaps using a toggle in the block sidebar.

@ramonjd
Copy link
Member Author

ramonjd commented Feb 2, 2022

Duplicate of #36225

Ha, thanks. I should have paid attention down the rabbit hole. I'll close this as I'm convinced it's not the best way forward anway.

Thanks @carolinan. You captured most of my deadends /beard scratchers and more.

What inner blocks should be available for a no results block? What do users need, to be able to create a good no results found message?

I'd think at least a heading and paragraph, even an image. Personally I'd want to be able to have an empty group block to play with so I could insert anything, but I know that might not be a realistic first goal.

@ramonjd
Copy link
Member Author

ramonjd commented Feb 2, 2022

I think we should be focussing on how to deliver an editable message before hardcoding one.

Just my 2c

See: #36609

@ramonjd ramonjd closed this Feb 2, 2022
@ramonjd ramonjd deleted the add/post-template-no-posts-message branch February 2, 2022 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] In Progress Tracking issues with work in progress [Type] Question Questions about the design or development of the editor.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants