Giter Site home page Giter Site logo

janboddez / indieblocks Goto Github PK

View Code? Open in Web Editor NEW
21.0 6.0 3.0 878 KB

Use blocks, and, optionally, "short-form" post types to more easily "IndieWebify" your WordPress site.

Home Page: https://indieblocks.xyz

License: GNU General Public License v3.0

PHP 79.34% JavaScript 18.99% CSS 1.55% Shell 0.12%

indieblocks's Introduction

IndieBlocks

Use blocks, and, optionally, "short-form" post types to more easily "IndieWebify" your WordPress site.

Why

This plugin lets you:

  • Add a "microblog" to either a new or existing WordPress site
  • Add Webmention support to enable rich cross-site conversations
  • Add "microformats" to your WordPress site's front end and posts, so that Webmention endpoints are able to correctly interpret your posts

How

IndieBlocks provides a number of blocks that can be used to add microformats to posts without having to tweak or know HTML. It also adds a number of "short-form" custom post types to more easily add a "microblog" to your site. (Both are optional, like, well, all of IndieBlocks features.)

IndieBlocks also "hooks" into the Micropub plugin, so that Micropub posts are given the correct post type, and, when applicable, "microformats" blocks.

If you're running a "block theme," it will attempt to add "microformats" to it. (If your theme already supports microformats, just leave this part disabled.)

There's also Webmention, which can be enabled for posts, notes, and likes (and any other post types of your choosing). This, in combination with the aforementioned microformats and this plugin's blocks, enables richer cross-site conversations. (If you're perfectly happy with your existing Webmention setup, here, too, you can simply leave this setting disabled.)

Classic Editor and Themes

IndieBlocks, despite its name, runs just fine on sites that have the Classic Editor plugin installed, or don't (yet) use a "block theme." The Custom Post Types and Webmention options will just work, as will most of its smaller "modules." Microformats, however, will need to be added some other way. (It's absolutely okay to run a "classic" theme with microformats support and add microformats to posts by hand or through a different plugin.)

Modules

  • Blocks: Add microformats to posts without having to think about HTML. There's also a couple blocks for use in theme templates (like the "Facepile" block for webmentions, or the "Link Preview" block).
  • Block theme "enhancements": Automatic microformats support for any (!) "block theme."
  • Webmention: Send and receive webmentions, for actual cross-site conversations.
  • Custom post types: Add "note" (i.e., a "microblog") and "like" sections.
  • Location: Add basic location and weather info to posts.
  • Link preview cards: Grab basic metadata from linked pages (to be used with the "Link Preview" block).

indieblocks's People

Contributors

janboddez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

indieblocks's Issues

Require wp-api-fetch

Although accessing our custom API endpoint currently works, we should probably explicitly require 'wp-api-fetch'.

Update Webmention prefix

Lots of webmention_comments_ prefixes still in the Webmention code, should probably move to indieblocks_webmention_ or something, and not break existing setups.

Add option to enable/disable Micropub block magic

Something like

if ( class_exists( '\\IndieBlocks\\Micropub_Compat' ) ) {
  remove_filter( 'micropub_post_content', array( '\\IndieBlocks\\Micropub_Compat', 'set_post_content' ) );
}

but in the form of a proper setting.

Save posts' types (or "kinds")

Since we're including the mf2 library, we could parse posts, theoretically, and store their implicit post "kind" (like, bookmark, etc.). Like, do that each time they're "published" and store the "kind" in a custom field.

We should be able to then use that information to determine if we should autogenerate a title, for instance.

Hash transient keys?

Our little parser uses transients to cache fetched HTML. The max safe key length is 172. Rather than use mb_substr, we should probably use just substr. Or SHA-256 or so (which outputs 64 bits and thus is safe). And accept the (super minimal?) risk of collisions. (Should one ever occur, the title field can be overriden manually, at least when posting from the editor.)

InnerBlocks

I've been avoiding InnerBlocks in favor of block patterns and templates, but if we want to offer even better (as in tuned to a specific post type) and easier-to-use microformats support, InnerBlocks may be the way forward.

Hide note titles

For those that don't wanna mess with theme templates, CSS, or both.

Also inside the editor? In Gutenberg, the title field can be huge. Makes little sense for "titleless" updates.

Automatically resend webmentions when a post is updated

While contemplating update/delete support, it'd be nice to have a button of sorts to be able to retrigger webmentions, like when a post was significantly updated.

(IndieBlocks currently limits the number of webmentions to 1 per post per outgoing link, even if said post is updated afterward. Reason behind this behavior is that not all endpoints support updates; some will just keep adding mentions.)

Likes and Notes show in classic editor

This looks really cool and I'm looking forward to using it!

I have all of the options enabled, but the Notes and Likes post types are still showing in the Classic editor for me.

CleanShot 2022-10-14 at 12 20 27@2x

Any ideas on how I can get these post types to use the block editor?

Better Webmention "comments"

Webmentions are now stored as regular comments and shown more or less like the trackbacks of yore. Except for likes, reposts, etc., where the comment will simply say, "... like this!" or something.

Either way, we should allow "facepiling" likes, much like the standalone Webmention plugin.

Permalinks not flushed?

I think this only an issue in the version on WP.org, i.e., will be automatically solved with the next release.

[Context block] Add author info as well

Move to dynamic rendering (or introduce one or several new blocks that are rendered server-side), and fetch linked pages in order to determine their title, author, and whatever other metadata, in order to more meaningfully display reply, etc., "contexts."

Block patterns

Notes and Likes now come with (slightly different) block templates.

This is somewhat annoying, because for regular notes, I'd rather start with an empty slate.

We could make the template optional and add block patterns instead.

"Example" Webmention form

Like, you know, the actual Webmention plugin. Could help familiarize folks with the concept, or invite spam. Or we could show it only for authenticated users, for testing purposes (but then they would have to put a [hidden] post up either way, and could "just" send an actual mention, because if the source page isn't found or otherwise does not actually mention the target page, the mention is immediately gonna get rejected).

Comments

Mark up the core comments block(s).

CPTs included in feeds, search?

This may be an artifact of block themes or how they call the query block, but CPTs seem to just pop up in search results and the main blog feed ...

Can't Disable Notes and Likes

Hi,
I am trying to disable Notes & Likes, I uncheck the boxes, Save Changes and the boxes are checked again.
I've tried a couple of other checkboxes and seem to be able to enable & disable them.

I am using Version 0.2.0 of the plugin. WordPress 6.0.3 I have quite a few other indieWeb plugins activated.

The only other setting checked in the IndieBlocks plugin is Enable blocks

Cheers

John

Outgoing delete support

Try to hook into trashed_post. Send webmentions for each previous mention, and hope the other end is able to deal with the 404 (I don't really intend to keep track of deleted pages and return 410s or a sort of "tombstone" template ...)

Consider another block for displaying just Likes and Reshares

Using the Full Site Editor to edit the comment section on my website I'm wondering if there is a good way to be able to separate the links and reshares so they can be stylized differently. I'm not sure about removing them from the other comments, maybe by comment type?

Post Formats

Both Post Kinds and IndieWeb CPTs support(ed) Post Formats. Plus, it's easy to add support.

Consider h-review, h-event, etc.

We currently only support h-entry (and focus especially on notes, bookmarks, likes, and reposts). Consider other post types.

The thing is, h-review and h-event probably have more in common (like, an actual title, although likes and bookmarks, too, could have titles) with actual posts than with short-form post types (all of which, except for likes, I call "notes").

Date archives

There's currently no date-based archives for notes and likes (because I don't use them, and a lot of microblogging services don't either). Maybe add them?

Modify Micropub content

Overwrite/append to default Micropub content (for supported post types).

Additionally, use use_block_editor_for_post_type( $post_type ) or similar to detect Gutenberg support, then immediately add the necessary block markup.

Move options checks to callbacks themselves

Currently, some of the options checks ("Is this option enabled") are in the register() methods, and then there's also checks in some of the actual callbacks.

The latter allows us to call these functions before flushing permalinks, for instance. If the option in question is disabled, no routes will be added or modified, and we're good.

Maybe, for consistency, we should move these into the callbacks themselves.

"Build" script

Because we stuck with WordPress' class filenames, and have now introduced a "helper" functions.php file, we're using classmap and files directives next to PSR-4 style autoloading for vendor classes.

This means that, after running php-scoper add-prefix, we need to update build/composer.json, add ../ in just the right places before running composer dump-autoload --working-dir build.

Be nice if this could somehow be automated.

Webmention

Either implement Webmention ourselves, and make it work without extra plugins, or ensure integration with the Webmention plugin, also for our CPTs.

Debugging statements

The WP CS might be against it, but debugging other people's sites is near impossible without proper logging (which should probably be disabled by default).

How to Use IndieBlocks

Hello @janboddez,
Can you tell me if there are any other required plugins for the IndieBlocks plugin?
And for Mastodon, then can you tell me how to use it and by that I mean, do you just pot a Like with the url of the Mastodon post, for example, and then publish the post? Or do you have to publish the post with some type of sharing?

I have all of the IndieWeb plugins installed except the ones that require the classic editor. In a reply to me on Mastodon a while back it seems like you mentioned that I might need to make an adjustment to something that related to Webmentions.

The reason I am asking is because I did test out the Likes today for a Mastodon post and I can't get it to work.

Thank you for your help!
Michelle

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.