Automattic / jetpack

Security, performance, marketing, and design tools — Jetpack is made by WordPress experts to make WP sites safer and faster, and help you grow your traffic.
https://jetpack.com/
Other
1.58k stars 799 forks source link

Instant Search: Better handling of untitled posts in search results #25438

Open a8ck3n opened 2 years ago

a8ck3n commented 2 years ago

Impacted plugin

Jetpack, Search

What

Posts without a title are visible in the minimal results but are inaccessible.

How

What it looks like now:

NoTitlesMinimal

Ideally, we'd detect this and either use a localized "Untitled" string or maybe the post slug. I'd favour the localized string because it might look odd if the site is not configured to use pretty permalinks.

a8ck3n commented 2 years ago

To reproduce the above:

  1. Visit a site with a Jetpack Search plan.
  2. Create a new post with content but without a title. Make sure "no title" is in the content.
  3. Wait for the site to sync and update the index or manually update it from WordPress.com or the Jetpack Debug page.
  4. Use the following string to bring up the results: /?s=no%20title&result_format=minimal
  5. Confirm the post is included in the results by its displayed category only.
  6. Confirm you can not click on it.
  7. Confirm you can tab to it.

Bonus Points: What happens if the post category is removed?!

By default, WP sites are configured to assign a default category. If the user removes all categories, the code will fallback to showing the post slug which is nice. I tried changing my permalinks to "Plain" and reloading the search overlay. Unfortunately that breaks search completely and all results lead to 404s. Refreshing the sync did not fix this.