developer-blog-content icon indicating copy to clipboard operation
developer-blog-content copied to clipboard

Static blocks vs Dynamic blocks - what's the difference

Open bph opened this issue 3 years ago • 15 comments

Discussed in https://github.com/WordPress/developer-blog-content/discussions/21

Originally posted by mburridge November 16, 2022 Article idea

Somehow the discussion didn't come over. I copy/paste comments from the Discussion.

Resources

https://design.oit.ncsu.edu/2019/03/11/choosing-dynamic-blocks-one/ https://github.com/WordPress/gutenberg/discussions/35918 https://kinsta.com/blog/dynamic-blocks/ Definitions

A type of block where the content of which may change and cannot be determined at the time of saving a post, instead calculated any time the post is shown on the front of a site. These blocks may save fallback content or no content at all in their JavaScript implementation, instead deferring to a PHP block implementation for runtime rendering.

https://developer.wordpress.org/block-editor/explanations/glossary/#dynamic-block A type of block where the content of which is known at the time of saving a post. A static block will be saved with HTML markup directly in post content.

https://developer.wordpress.org/block-editor/explanations/glossary/#static-block

@wordpress/create-block will build a dynamic block with the following option:

$ npx @wordpress/create-block --variant dynamic

Blocks can be static or dynamic. Static blocks contain rendered content and an object of Attributes used to re-render based on changes. Dynamic blocks require server-side data and rendering while the post content is being generated (rendering).

from here.

bph avatar Feb 03 '23 06:02 bph

Huge Thank you to Joni Halabi for taking on this content. Please comment on this issue, so it can be assigned to you.

bph avatar Feb 03 '23 06:02 bph

Just adding this resource here in the hat since I have some thoughts on the topic: https://gutenberg.10up.com/reference/Blocks/custom-blocks#dynamic-blocks :)

Happy to also help review this when it's ready or contribute in any way I can :) Really looking forward to what you come up with Joni :)

fabiankaegy avatar Feb 03 '23 07:02 fabiankaegy

Commenting on this issue so that I can be assigned to it. :)

thatdevgirl avatar Feb 03 '23 21:02 thatdevgirl

I have an updated draft! Is it OK to post drafts here or is there a better place to post a draft? (This is my first WP post.)

thatdevgirl avatar Feb 07 '23 19:02 thatdevgirl

We habe two options:

  1. You can post a link to a Google doc and people can comment there.
  2. You get author access to the blog and you can post a draft there. We have Public Post Preview installed, and feedback will.be shared on this issue.

Let me know which you prefer..

bph avatar Feb 08 '23 07:02 bph

I prefer the Google doc. I think it will be easier to track discussions and comments there.

Here is the link to my draft: https://docs.google.com/document/d/1TecVPkATrySRy5Dtj7GaQBg1L9rAtYdkCznskBxe9RA/edit?usp=sharing

Feel free to comment as much as you would like and please let me know if you have questions. Thank you all!

thatdevgirl avatar Feb 08 '23 18:02 thatdevgirl

@thatdevgirl - Thanks for putting this together. I'll be running through the doc and providing some feedback today. I'm really looking forward to this being on the Dev Blog.

justintadlock avatar Feb 14 '23 17:02 justintadlock

I've left a few comments in the post. This is shaping up to be really great!

Aside from my in-doc notes, I'd love to see a couple of screenshots of both static and dynamic blocks in the editor. They'll just help readers better visualize things and break up the text a bit more.

justintadlock avatar Feb 14 '23 20:02 justintadlock

@fabiankaegy & @justintadlock - Thank you so much for reading and commenting on the article! I made several edits based on your comments and added a couple of screenshots. Please let me know what you think. Thanks!

thatdevgirl avatar Feb 15 '23 20:02 thatdevgirl

As far as I'm concerned, it looks good to go.

I've moved this over to "Needs 2nd review." @abhansnuk - Did you do the second review (I saw a comment from you in there)? If so, we can move this the "Ready to publish" stage.

justintadlock avatar Feb 21 '23 21:02 justintadlock

Hello, Yes second review completed. It will need the credits added at the end and excerpt when added to the CMS. Back to you @thatdevgirl .

Note to self for general follow-up : https://wordpress.org/documentation/article/wordpress-block-editor/ has Block Editor with caps B and E.

abhansnuk avatar Feb 25 '23 09:02 abhansnuk

I added credits to the end of the article, copied below. I used everyone's WordPress handles, but please let me know if I should have used a different handle for everyone:

Props to @fabiankaegy, @greenshady, @mburridge, and @webcommsat for reviewing this post.

I also wrote an excerpt, which I added to the very bottom of the Google doc.

What happens next in terms of publishing? (I don't have access to publish.)

Thank you all!!

thatdevgirl avatar Feb 26 '23 22:02 thatdevgirl

@thatdevgirl I just invited you to the Developer Blog site. You need to confirm via the link in the email. :-) The tips and guidelines for writers you already read, so this is just a reminder..

Here is a short pre-publish check list.

  • [ ] Post Title in Sentence case
  • [ ] Are Category or Categories selected?
  • [ ] Are Tags identifies?
  • [ ] Is there an Excerpt?
  • [ ] Props added (right aligned, italics)

If you share the Public Preview Link, I'll double-check :-)

bph avatar Feb 27 '23 15:02 bph

@bph I just drafted the post. Here is the preview link: https://developer.wordpress.org/news/?p=879&preview=true

Thank you so much!

thatdevgirl avatar Feb 27 '23 15:02 thatdevgirl

I removed the two mention of Gutenberg, at the beginning and published the post. Developer Blog: Static vs. dynamic blocks: What’s the difference?

Congratulations! And Thank you so much for your great work!

bph avatar Feb 27 '23 15:02 bph