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

Generates excerpt using core get_the_excerpt #19669

Merged
merged 3 commits into from Feb 4, 2020

Conversation

draganescu
Copy link
Contributor

@draganescu draganescu commented Jan 15, 2020

Description

Closes #19418

How has this been tested?

Tested locally in browser by making some posts with embedded tweets and then another using the latest posts block.

The way to test:

  • make a post or more with some tweet embeds and some text.
  • mare sure the embed is close to the start of the post.
  • make a post and use the latest posts block
  • set the block to show excerpt
  • there should be no tweet links in the excerpt

Types of changes

The latest posts block does, I believe, two wrong things about the excerpt:

  • in the server side renderer it uses a custom way to get the excerpt which bypasses the core function that among other things renders only allowed blocks, strips shortcodes and a lot more.
  • in the client side renderer it gets the rendered excerpt and then wrongfully checks for the raw excerpt, which may be empty if post has no manual excerpt, resetting the rendered excerpt with the raw post content.

This is what this PR fixes.

@talldan
Copy link
Contributor

talldan commented Jan 24, 2020

@draganescu Would you be able to provide some testing instructions, what should I look out for when testing?

I might be doing something wrong, but I still see the tweet URL in the latest posts block:
Screen Shot 2020-01-24 at 12 54 03 pm

@draganescu
Copy link
Contributor Author

hey @talldan thanks for trying this out:

The way to test:

  • make a post or more with some tweet embeds and some text.
  • mare sure the embed is close to the start of the post.
  • make a post and use the latest posts block
  • set the block to show excerpt
  • there should be no tweet links in the excerpt

Do not use the full content option, that is a different issue I think.

@draganescu
Copy link
Contributor Author

So @talldan the problem you encountered is that in the Latest Posts block there was a fallback which used the full post in case there was an empty excerpt. Now, I am not sure this fallback is the best option.

If I select excerpt, and the excerpt:

  • either shows the excerpt
  • or makes one from the post itself

... then there is no reason for the fallback.

The filtering of blocks from content does not apply (and shouldn't) for full post content.

Can you retest? Should be OK now.

Copy link
Member

@ajitbohra ajitbohra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as expected, code-wise LGTM 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

If a tweet is in excerpt it shows the link url not content
3 participants