Troubleshooting & How-Tos 📡 🏷️ 🔍 Gemini Protocol

Enable Gemini (and other Small Internet) Links in WordPress

I use the Syndication Links plugin on my blog to link to social media posts that link back, or that I’ve incorporated into the blog entry. Or to mirrored photos on Flickr, or posts on Tumblr. As part of exploring Gopher, I’ve been cross-posting more, and decided I should start linking to the Gemini copies of my posts the same way.

Except Syndication Links wouldn’t accept gemini: URLs. It would accept gopher: URLs.

I dug around and determined that it’s not the plugin, but an internal WordPress/ClassicPress function. wp_allowed_protocols validates URLs, but doesn’t recognize the protocol. By default it allows http, https, ftp, ftps, mailto, news, irc, irc6, ircs, gopher, nntp, feed, telnet, mms, rtsp, sms, svn, tel, fax, xmpp, webcal, and urn.

So then I needed to figure out where I could add something to the list. I found an example adding Skype URLs and swapped in gemini. Then I added nex and spartan to check whether adding more smolnet protocols would work the way I expected it to. (It does.)

function exampleprefix_allow_smallnet_protocols( $protocols ){
	// Add more protocols to the end of the list.
	$protocols[] = 'spartan';
	$protocols[] = 'gemini';
	$protocols[] = 'nex';
	return $protocols;
}
add_filter( 'kses_allowed_protocols' , 'exampleprefix_allow_smallnet_protocols' );

Problem solved! Now I can add both Gopher and Gemini links using Syndication Links, and anywhere else the blog uses wp_allowed_protocols!

Except…the plugin doesn’t have icons for them, so it’s using a warning icon. That’s not ideal. Fortunately I already know how to add icons to Syndication Links.