14/05/2020

The archive contains older posts which may no longer reflect my current views.

# I no longer draw attention, or even link, to the Webmention Directory although it's still there and working - you just have to go direct, but there was something annoying me about how it was working or, rather, what webmentions from some sites made it do.

The way it's designed to operate is that it checks if the author of a webmention has already been listed so that there aren't duplicate entries but some sites, for whatever reason, don't send the author as just a name - they might also include the post title for example - meaning the author check fails.

In the past I have manually edited the author information via the backend but decided to semi-automate the process.

I added an extra box on the plugin settings page which allows me to enter name/url pairs (comma separated with each pair separated by a semi-colon) and code to check the author's domain against this list. If the URL exists in the list the author is automatically set to the corresponding item in the pair and duplicates are ignored.

If I no longer link to the Directory why even bother? Isn't it just a waste of time and effort? Maybe. I suppose it's the knowledge that it's still there but not working entirely as I would like.

If anyone still uses the Directory plugin and would like me to update the version on GitHub let me know.

# The blog has been using the Fragmentions plugin for some time. This allows you to link to, and visually indicate, specific parts of a target post.

Recently I improved the styling of the linked "fragments" but wanted to go one stage further.

Having remarked that displaying internal webmentions as 'related posts' created a sort of bi-directional system of connections within the blog I felt that this could be enhanced. Yes, listing them 'works' but what if the fragments they linked to were identified in some way?

Challenge accepted.

When a webmention is received it writes any URL fragment to the database along with the source address so I just needed to check if each webmention has such a fragment and was from my own blog. Then I change the text within the body of the post to a link and format it differently; I've chosen a subtle dotted underline:

Now internal webmentions truly are bi-directional.

I think theres a couple of kinks I need to work out but will look at them as they crop up.

1 comment: click to read or leave your own Comments

# Typical, just as I post about internal webmentions the blog refuses to send internal webmentions.

1 comment: click to read or leave your own Comments

# I think the webmention issue might have been a host problem as my FTP account also appeared to go missing for a while. It's back now so hopefully we're all good again.

Update: looks like I spoke too soon!

Update 2: fingers crossed, I think it was just a bit slow.

# The new code and the fragmention plugin were conflicting and I think this was the source of some of the glitches. So I've ditched the plugin and written some javascript to achieve the same thing.

var loc = location.href;
var hash = loc.substring(loc.indexOf('##')+2).toLowerCase();

while (hash.indexOf('+') !== -1) {
  hash = hash.replace("+", " ");
}

var pTags = document.getElementsByTagName("p");

var x, y, pContent;

for (var p = 0; p < pTags.length; p++) {
  pContent = pTags[p].innerHTML.toLowerCase();

  if (pContent.indexOf(hash) !== -1) {
    x = pTags[p].innerHTML;
    y = "<p fragmention>" + x + "</p>";
    pTags[p].outerHTML = y;
    break;
  }
}

That's it!

There's not much to it at all and I don't really know what the plugin does extra.

1 comment: click to read or leave your own Comments