Giter VIP home page Giter VIP logo

Comments (9)

janboddez avatar janboddez commented on August 18, 2024

Note: "ServerSideRender should be regarded as a fallback or legacy mechanism, it is not appropriate for developing new features against." https://developer.wordpress.org/block-editor/reference-guides/packages/packages-server-side-render/

That said, I really meant "dynamic blocks" rather than "blocks using ServerSideRender," although the latter would allow proper in-editor previews, whereas dynamic blocks would only be rendered on the front end, and stick to a Placeholder in-editor.

from indieblocks.

janboddez avatar janboddez commented on August 18, 2024

And:

This package is meant to be used only with WordPress core. Feel free to use it in your own project but please keep in mind that it might never get fully documented.

from indieblocks.

janboddez avatar janboddez commented on August 18, 2024

On dynamic blocks:

Blocks where updates to the code (HTML, CSS, JS) should be immediately shown on the front end of the website.
https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/creating-dynamic-blocks/

This is sort of applicable, especially if we schedule ("delay") the fetching of linked pages. (If we do everything inline, not so much.)

from indieblocks.

janboddez avatar janboddez commented on August 18, 2024

Nice example of ServerSideRender on that last page, too.

from indieblocks.

janboddez avatar janboddez commented on August 18, 2024

Not sure what would happen to dynamic blocks if the plugin is uninstalled, though. I don't like the idea of a "lock-in" of sorts, which is why I prefer blocks over other solutions (meta boxes, etc.).

Think it may be possible, though, to save the output of a ServerSideRender component. (Attributes get saved immediately whenever they are modified.)

from indieblocks.

janboddez avatar janboddez commented on August 18, 2024

Alternatively you can make the save function a cached version of the block that can be displayed if the plugin containing the block is deactivated. Essentially you’re saving some form of fallback markup for the block to use in the case the server-side rendering function goes away.
https://jasonyingling.me/building-dynamic-blocks-for-the-gutenberg-editor-in-wordpress/

from indieblocks.

janboddez avatar janboddez commented on August 18, 2024

Current behavior is we try to fetch the page's title. We can make this smarter, look for microformats (incl. author info), and then fall back on just the title, although things aren't too bad as they are.

from indieblocks.

janboddez avatar janboddez commented on August 18, 2024

Author info is added to API endpoint (if the page we link to turns to be marked up as a h-entry, at least), but not yet used in the block

from indieblocks.

janboddez avatar janboddez commented on August 18, 2024

The "Better Context" block (or whatever I end up calling it) now has this.

I likely won't add avatars or author URLs. I used to go with just plain URLs, in fact, for years; worked OK for me.

from indieblocks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.