I’ve been tinkering around with IndieWeb integration on this site and wanted to document some notes getting all this running with a block theme.
Theme
I’m running a mildly customized version of Pulitzer. I’ve used the Create Block Theme plugin to export my changes and have published it as a standalone child theme here.
Changes are mainly typography and header/footer changes. I’ve raised the font sizes across the board and switched to using system fonts to avoid shipping font files. Modern Font Stacks is lovely and I found this tiny plugin to pull all the families in to the font library.
I’ve also started extending Pulitzer’s existing block bindings. I’m testing this as a stand-in for Syndication Links:
<!-- wp:paragraph {"metadata":{"bindings":{"content":{"source":"putz/post-syndication-links"}}}} -->
<p>[syndication links]</p>
<!-- /wp:paragraph -->
Block Binding Callbacks
function putz_block_binding_callback_syndication_links
( array $source_args, WP_Block $block_instance, string $attribute_name ) {
$post_id = $block_instance->context['postId'] ?? get_the_ID();
$links = get_post_meta( $post_id, 'mf2_syndication', true);
if ( empty( $links ) ) {
return false;
} else {
return 'Also on: ' . implode( ' ', array_map( function($link) {
$domain = wp_parse_url( $link, PHP_URL_HOST );
return "<a href=\"$link\">$domain</a>";
}, $links ) );
}
}
Plugins
Relevant Plugins
Plugin | Version |
---|---|
IndieAuth | Version 4.5.2 by IndieWeb WordPress Outreach Club |
IndieBlocks | Version 0.13.0 by Jan Boddez |
IndieWeb | Version 4.0.5 by IndieWebCamp WordPress Outreach Club |
MF2 Feed | Version 3.1.1 by IndieWeb WordPress Outreach Club |
Micropub | Version 2.4.0 by IndieWeb WordPress Outreach Club |
Syndication Links | Version 4.4.20 by David Shanske |
Webmention | Version 5.3.3 by Matthias Pfefferle |
WebSub | Version 3.2.1 by PubSubHubbub Team |
IndieBlocks
I’m using IndieBlocks to provide microformats markup throughout my site. I’m also using the Note and Like post types. I’ve decided to keep those out of my main blog feed. Here’s the configs.
Syndication Links
The Syndication Links plugin handles publishing the actual syndication posts, and I use the hidden links for the markup. The clickable links are currently displayed with a block binding.
IndieAuth
This requires essentially no configuration, but I did find a nasty bug in the plugin code and helped debug a bit. Logging in with IndieAuth was hanging indefinitely, getting killed by php-fpm, and throwing a 504 timeout. I’m not super familiar with the code but this is the PR that fixed it.
Shoutout to dshanske for helping me figure this one out and releasing a new plugin version with the fix!
Bridgy
I’m using both Bridgy and Bridgy Fed. I’m currently trying out POSSE for my mastodon and bluesky posts with Bridgy and publishing them as Notes here on this site. These are the publish targets I use via Syndication Links:
My solution for keeping Notes and Likes out of my main blog feed was making sure to show them in my author feed in the IndieBlocks settings and adding a rel=feed link to my author page in the header.
add_action( 'wp_head', function() { ?>
<link rel="feed" type="text/mf2+html" href="https://benharri.org/author/ben/" />
<?php } );
The other solution I tried for this was using MF2 Feed and including them as rel=alternate but Bridgy doesn’t support mf2+json feeds yet. There’s an open issue to add support for this use case.
One remaining thing that I haven’t figured out yet is pulling the syndication links out of the logs into the proper post meta. Still haven’t narrowed this down fully but it works perfectly fine when publishing with a Micropub client like Quill or IndiePass, so it feels like something to do with the block editor.
My workaround is wp-cli + jq and feels entirely unsatisfying. Hoping to get that figured out soon.