-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Latest Post Block (Post Content Support) iteration #14627
Latest Post Block (Post Content Support) iteration #14627
Conversation
Try to see the preview of the post with new options applied :) |
package-lock.json
Outdated
@@ -4753,8 +4753,7 @@ | |||
"ansi-regex": { | |||
"version": "2.1.1", | |||
"bundled": true, | |||
"dev": true, | |||
"optional": true | |||
"dev": true |
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.
That's surprising. Ideally, there should be no difference in package-lock.json
file. Which version of npm do you use?
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.
I am using 6.4.1
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.
Can you remove changes to package-lock.json
from this PR? You can copy the original lock file from master
branch.
import { | ||
InspectorControls, | ||
BlockAlignmentToolbar, | ||
BlockControls, | ||
} from '@wordpress/block-editor'; | ||
} from '@wordpress/editor'; |
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.
There are some ongoing code reorganizations and those components were moved to the new package. They will continue to work from @wordpress/editor
(with maybe some warnings) but it should stay unchanged.
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.
Thanks for the heads up! Should I change it back to @wordpress/block-editor too?
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.
Yes.
I have completed most of the functionality, but I have a few design and development questions. Design Questions:
I think this is redundant and may take up unnecessary space in 'Display Full Post' but may be useful in 'Display Post Excerpt', because it won't be repeating the same information already on the page in the latter case.
I would prefer not displaying anything as an excerpt is inherently a summary and the first few lines of the post content wouldn't fit in in this category generally.
Development Question:
|
My gut says "no," but I'm open to hearing other opinions.
We should show the post content truncated to whatever number of characters is being used for excerpts.
Can you add some screenshots? Hard to visualize. Thanks for all your work on this! |
I think you might want TestingIt's great to see this coming on so well. Great work! 👍 I've tested and have noticed a few issues which I'll document below as I find them:
It then goes on to suggest how to add one manually. I think we should have an option to add/remove a Read more link?
|
@youknowriad Technical question. I can imagine developers needing to amend the markup generated by this Block. For example you might need the author to be displayed underneath the post content rather than above it. Would the I'm conscious that if a theme has a particular |
Hi @AmartyaU great job! The column spacing is fixed! :D However, I found some new issues :P 1. The read more link is floated when the post contains a gallery: This causes even worse problems when the gallery is in the middle column: 2. We should strip the tags and formatting of the excerpt so that we can be sure of the result, not like in this case the bullets ruin the layout: I think we shouldn't display galleries at all, and strip tags would help in this problem too as all img tags will be removed. |
I think that's the right thing to do! So basically I should strip all the tags on the editor side so that when post content is displayed in place of excerpt (when a post doesn't have an excerpt), it follows a proper format (without images)? I think server side already does this, so I can just replicate that behavior. |
3c66c1e
to
2699ea4
Compare
I just added a commit that proposes a solution to the above, but I would appreciate it if you would take a look at it. Instead of using Regex, I used https://ctrlq.org/code/19813-convert-html-to-text in my solution and it looks to be working fine. The excerpt displayed on the editor is identical to that displayed on the server side as shown below: Full Post Content Excerpt on Editor Side Excerpt on Server Side |
Great work on this.
I'm concerned about this. Are we proposing stipping all blocks/tags from the "Full Content" version? I can envisage a use case where someone wants to display their full latest posts on a page. If all tags and blocks are stripped from the content then that use case will not work. It's far from ideal that the layout looks poor if this block is used within another Block or the post themselves contain complex Blocks. However, that seems like more of an edge case to me. What about adding an option to strip tags/content rather than applying as a blanket default? |
No, we are not proposing to strip all blocks/tags from the "Full Content" version. The "Full Content" version will still display everything as before. We are just stripping the blocks/tags for the excerpt in the case when a post doesn't have an excerpt and has to use its post content. Since excerpts don't have formatting, we want to be consistent when a post uses its post content as its excerpt and that is the reason we are stripping all tags in that particular case! |
@getdave indeed, the tags are stripped only from the excerpt, especially the one that is generated automagically from the post. Do you find any reason to allow them? The problem with tags in automatic excerpts is that you can mistakenly print unclosed tags and also some formatting or content (media) doesn't make any sense in an excerpt. @AmartyaU great work! I have left only one comment. other than that we're good to go! |
@AmartyaU One more thing I noticed is that when articles are displayed along with post content the markup isn't particularly accessible. In this context my questions are:
These may be problems to be solved in a v2. If so I'm happy to raise a separate issue. |
I think raising a separate issue about this would be best! |
Nice addition here. Thanks all. |
Description
Adds Post content support in #1594. @ajitbohra is working on all the other parts of the issue (#13698).
Work In Progress
Screenshots
Editor Side Display Excerpt
Rendered Display Excerpt
Editor Side Display Full Post
Rendered Display Full Post
@gziolo @melchoyce You can track the progress on the issue here!