TIL that Yoast overrides core #WordPress’s inline link popover in order to add `nofollow`/`sponsored` toggles. All us #IndieWeb folk now need is for someone to do the exact same but add a `class` input field, so we can add `u-*` classes without having to constantly fight the block editor.

I’d much prefer this over a custom block (or some kind of meta box approach), as I want to be able to add such links anywhere in a post’s content.

(Thing is, you can “Edit as HTML,” but switching back to the [visual] link editor will remove your manually added attributes.)

Found some more code examples and am now able to either add a new formatting button that will trigger a completely inaccessible “href” popover but otherwise sorta works, or replace the core link button with something that, uh, will add an `a` tag with a class. But I’m a React noob. Plus, _all_ we need is for core links to accept a class.


@jan Jan, I believe there are programmic ways of accessing the blocks. Either by filter or some other method:


@nathand Custom blocks, patterns, or variations could be very handy, too, but the one thing I would really like is a way to easily address _inline_ links, e.g., those inside a paragraph block. (You’d pretty much have to create your own `Format`, i.e., what Yoast does.) One thing I could probably do, tho, is just add a class to the parent block and then let the `the_content` filter, i.e., PHP, handle the rest.

Sign in to participate in the conversation

Fosstodon is an English speaking Mastodon instance that is open to anyone who is interested in technology; particularly free & open source software.