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

Try using the excerpt block to display format like posts #53465

Closed
wants to merge 1 commit into from

Conversation

draganescu
Copy link
Contributor

@draganescu draganescu commented Aug 9, 2023

What?

Idea for #28564

There was plenty of feedback in #53049 about the usefulness of post formats and how although supported they're hard to figure out when one uses a block theme.

Why?

One thing about post formats is that they overlap a lot with CPTs. To render a special template for a special kind of post we have CPTs which can have their own single and archive templates. Post formats on the other hand use the standard post template but as taxonomy allowed special rendering in the loop, particularly for title less situations (e.g. a status post).

This exploration aims to see if simply fixing the part around query loop rendering is enough to replace the need for post formats: after all a post with one image block is an image post format, a post with one paragraph block can be a status format or a link format etc.

How?

Makes the excerpt block

Testing Instructions

In a block theme:

  • open a template , the index or front page are best
  • add or edit the query loop in the page by adding in the post template an excerpt block
  • from the inspector of the excerpt block toggle on "Behave as title replacement" (TBD)
  • add some title less posts with links, videos, images, text
  • see the front end and how the loop looks now

Testing Instructions for Keyboard

N/A

Screenshots or screencast

excerpt-1st-block.mp4

@github-actions
Copy link

github-actions bot commented Aug 9, 2023

Warning: Type of PR label error

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Type-related labels to choose from: [Type] Accessibility (a11y), [Type] Automated Testing, [Type] Breaking Change, [Type] Bug, [Type] Build Tooling, [Type] Code Quality, [Type] Copy, [Type] Developer Documentation, [Type] Enhancement, [Type] Experimental, [Type] Feature, [Type] New API, [Type] Task, [Type] Performance, [Type] Project Management, [Type] Regression, [Type] Security, [Type] WP Core Ticket, Backport from WordPress Core.
  • Labels found: Needs Design Feedback.

Read more about Type labels in Gutenberg.

@draganescu draganescu added the Needs Design Feedback Needs general design feedback. label Aug 9, 2023
@MaggieCabrera
Copy link
Contributor

MaggieCabrera commented Aug 9, 2023

One great thing about this is that it's working with read more out of the box, so that's really neat!
I'm worried that we are missing some of the features of the excerpt for regular "titled" posts when we toggle the excerpt for the title less ones.

I tried a few different posts, one with an audio block (worked great), one with a lot of text and a read more block (also worked as intended) and one with a youtube embed. That last one didn't work, we are filtering it somewhere.

Screenshot 2023-08-09 at 12 30 53

@MaggieCabrera
Copy link
Contributor

In fact, when we toggle this option, we miss the excerpt for titled posts, I guess we could have it twice, but that's kind of confusing? I do like the possibilities this enables, we just gotta tweak the UX

@MaggieCabrera
Copy link
Contributor

/cc @WordPress/block-themers you bunch should have a look at this

@jasmussen
Copy link
Contributor

Thanks for exploring. I'm a little concerned about adding more toggles, vs. adding better smarts in the query loop and the interface itself. I think @richtabor had thoughts on this as well.

@draganescu
Copy link
Contributor Author

I think the toggle is needed because we reuse the block for multiple purposes. It's easy to default the excerpt to 1st block if three is no title even without the block, but in the loop when a post has title and body but you don't want the excerpt what to do? :)

@jasmussen
Copy link
Contributor

I mean instead of the toggle, we have some smarts that make the use case happen without having to find the toggle in the first place.

but in the loop when a post has title and body but you don't want the excerpt what to do?

I'm most likely missing a little additional nuance, but in this case would we ever want to both show excerpt and post content together?

@draganescu
Copy link
Contributor Author

I'm most likely missing a little additional nuance, but in this case would we ever want to both show excerpt and post content together?

No, we want to show either the title or the content if there is no title.

@jasmussen
Copy link
Contributor

Right, so in principle in the query loop we could be smart about it, and note that if there's post content AND an excerpt block, show only post content? Apologies if I'm missing more nuance, it's been a long week.

@draganescu
Copy link
Contributor Author

No need for apologies :D maybe it's super clear to you and I don't see it. Let's go through this:

  • goal: when a post has no title in the loop use the excerpt block to show 1st block in content
  • with toggle: look for the toggle
  • with no toggle:
    • query loop renders post with no title
      • no title -> excerpt block renders 1st block
    • query loop renders post with title
      • title is rendered
      • title -> excerpt block renders excerpt, which does not have to be set, it's made out of content

To avoid, with no toggle, rendering title and excerpt, we should manually code into the query loop that if there is a title the excerpt should only render if a manual excerpt is set. But what if someone does not want this, and they want titled posts to render title, excerpt and title less posts to render1st block?

How can the user override the behavior of the query loop without any UI to do it?

I think if we aim for a more seamless behavior we should instead update the title block to render the 1st block if there is no title. This seems more obivous than wrangling when to have and when to not have an excerpt, and could work without any toggle.

@draganescu
Copy link
Contributor Author

This has been a nice exploratio but definitely using a block to trick the rendering of the loop is not very elegant, while smart. With a toggle or a smart behavior it's still weird. In wp-format-enabler i am exploring alternatives that work with the query loop and post template.

@draganescu draganescu closed this Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Design Feedback Needs general design feedback.
Projects
Development

Successfully merging this pull request may close these issues.

3 participants