Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
$wgExtensionFunctions[] = "relWebmention";
$wgExtensionCredits['parserhook'][] = array(
'name' => 'Rel Webmention',
'author' => 'Aaron Parecki http://aaronparecki.com',
'description' => 'Adds <nowiki><link rel="webmention"></nowiki> tag to advertise a Webmention endpoint on every page',
'url' => 'https://gist.github.com/aaronpk/7de5b63c58bc00e9e2cda434432ed0d3'
);
function relWebmention()
{
global $wgHooks, $wgParser;
$wgHooks['OutputPageBeforeHTML'][] = 'RelWebmention::onOutputPageBeforeHTML';
}
class RelWebmention
{
public static function onOutputPageBeforeHTML(OutputPage &$out, &$text)
{
global $wgRequest, $wgWebmentionEndpoint, $wgPingbackEndpoint;
$out->addHeadItem('webmention', '<link rel="webmention" href="' . $wgWebmentionEndpoint . '">'."\n");
$out->addHeadItem('pingback', '<link rel="pingback" href="' . $wgPingbackEndpoint . '">'."\n");
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.