-
Notifications
You must be signed in to change notification settings - Fork 315
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
Make "10-dynamic-block" more dynamic #203
Comments
Add post count to dynamic block output to demonstrate how values can be included in the block output that are updated without updating the post itself. Resolves WordPress#203
Just to clarify, the current example doesn't behave in the same manner as a static block as its markup is never saved to the database. However, I completely understand what you're intending with this issue :) I like the idea of adding a more fleshed-out example that demonstrates the benefits of a dynamic block:
From an examples point of view, the second point is much easier to demonstrate with working code as it doesn't require the same block with multiple sets of markup. |
Since this is a dynamic block, we can modify the markup at run time (instead of saving the markup in the database to be displayed). In this case, we are appending the Site Title of the blog to the message being output. If we were to go to Settings > General and modify the "Site Title" setting, the rendered output would change (without our re-opening the post in Gutenberg). See WordPress#203
The Site Title is not modifiable within the block, but if we were to go to Settings > General and modify the "Site Title" value. When we reload the post in Gutenberg, the Site Title would be updated. See WordPress#203
* Append blog Site Title to dynamic output Since this is a dynamic block, we can modify the markup at run time (instead of saving the markup in the database to be displayed). In this case, we are appending the Site Title of the blog to the message being output. If we were to go to Settings > General and modify the "Site Title" setting, the rendered output would change (without our re-opening the post in Gutenberg). See #203 * Display the Site Title in our block The Site Title is not modifiable within the block, but if we were to go to Settings > General and modify the "Site Title" value. When we reload the post in Gutenberg, the Site Title would be updated. See #203 * Add "loading..." message for site title See https://github.com/WordPress/gutenberg-examples/pull/216/files#r870644522 * Fix linting errors
While
10-dynamic-block
does use a dynamic block currently, it behaves in the same manner as a non-dynamic block.It would be helpful to see the value provided by a block being dynamic (e.g. output a value that could be modified after the post was published).
The text was updated successfully, but these errors were encountered: