As I was looking at repurposing my local WP install on my laptop in light of the wiki experiments I mentioned yesterday, I wanted to add the Category to Pages plugin I use on my blog to my local WP instance. Turns out that plugin was closed 18 months ago. I never noticed, as a WordPress install does alert you to plugins that have updates available, but clearly doesn’t warn you if a plugin is no longer being maintained. It seems the developer has closed down all his WordPress activities, with accounts deleted, his domains let go (except for his main one).

I use the Category to Pages plugin on my blog to be able to use Pages as a one-person wiki. The categories provide navigational structure, and make having hub pages easy (through category archives). There is one similar plugin that has been maintained in the past six months, which possibly is a replacement. I would need to check if it can take over seamlessly from the previous plugin, or that I need to recreate the categories and tags for pages that are currently in use. Alternatively, although the old plugin can’t be downloaded anymore, I can copy the old one over to my local WP instance for now. But probably better to have both WP instances use a plugin that is maintained.

Replied to Now supporting Webmention by Jeremy Felt (jeremyfelt.com)
I think? If you know how to send a Webmention, please do so that I know it works!....I’ll need to do some spelunking to figure out how I want to display and style them

Welcome to using WebMention, Jeremy. Still figuring out how to best use it myself with regard to how they get displayed on my site.

Like you I use WordPress, and I would love for mentions to display more like the old pingbacks, where you’d get a snippet from the mentioning site from around where it links to you. Now it mostly is ‘site x mentioned this.’ which makes me click to get a notion if it’s relevant.

On Webmention tweaks I documented some of the things I tried. The issue is that because the tweaks are in the Semantic Linkbacks plugin, not in the WP theme, you can only make those tweaks a permanent option if it gets rolled into the plugin (no such things as a child-plugin like with themes). And I’m not confident enough of my changes to figure out and try submitting them to the maintainers of the plugin.

Elmine, in her role as resident WordPress expert, pointed me to MainWP. MainWP is a tool that allows one to manage updates of WordPress and plugins, from a separate single WordPress instance.

That separate single WordPress instance doesn’t need to be online, and can be hosted locally. So I installed it on my laptop. That way there is no attack surface for the outside that would risk allowing access to my 6+ sites that run WordPress.

It turns out, an added benefit is that I can also post to any of those sites from this local instance. This has as an advantage that I can draft postings offline on my laptop, and then push them to a website when done. That should help me write more and with a lower threshold. It has a few drawbacks, as offline I don’t have access to some features I use regularly (post kinds, and more importantly previews).

This post serves as a test, posting from my wordpress instance on localhost.

My site until now didn’t indicate very well in which language my postings are written. I write here mostly in English, but also sometimes use two other languages, Dutch and German.

My friend Peter pointed out to me that if he reads Franks blog in his feedreader and clicks on the link his browser automatically translates it into English. As Peter suggested, this is most likely because Frank’s site declares Dutch as its language, and mine declares English. I decided to look into it and see if I could change that.

The language declaration Peter pointed to is the very first statement in the source code for this page:

Frank’s site in the same space says his site is in Dutch.

Frank also publishes in English sometimes, and then the language setting would be factually incorrect. Peter just wouldn’t notice as he wouldn’t attempt to translate English, his native language.

My company’s website in contrast declares three languages, by giving a different url for English and German, next to the regular Dutch. However in this case it is about the same or similar pieces of content made available in different languages. Which is not the same use case as my blog, where there is different content in different languages.

I concluded I needed to figure out how to a) for the category archive pages for Dutch and German postings declare the right language (because I mark any posting not in English with a separate category corresponding to its language), and b) for individual postings not in English declare the right language.

First I looked at what the W3C says about indicating content languages. It turns out Frank and I both do it right, the html statement is the place to declare the default language of a website. In Frank’s case Dutch, in my case English. The W3C goes on to say that any other languages should be indicated in the location where they are used. This e.g. would allow me to indicate the correct language even if I use a non-English phrase in the middle of an otherwise English text, hetgeen een mooie oplossing is voor automatische vertaalsoftware. Which looks like this in html:

This means that what I needed to do was for the category archive pages for Dutch and German, as well as for individual postings, find the right spot in the source of a page to declare the correct language. I did this in the WordPress Theme I am using, or rather in the child theme (which allows you to specify any deviations from the original theme, while keeping the rest of the theme as it was).

For both the Dutch and German category pages I created separate templates, called category-nederlands.php and category-deutsch.php, which corresponds with the name of the category in my WordPress instance. At the top of those pages I added a language indicator where the main part of the page starts.

For individual blogposts it is a bit more difficult, as you need to be able to determine first if a posting is in another language than English. I adapted the single.php template, which renders individual postings. There I added a line of code to see if the posting is in Dutch or German, by checking if it is in the corresponding category.

This results in either adding lang=”nl-nl” or lang=”de-de” to postings in those languages, in the same location as for the category archive pages shown above.

Hopefully this now allows browsers to correctly detect the language of content on my site.
I’m not entirely done yet. Because in some overviews, like the front page, individual postings that are not in English are not rightly marked with the correct language yet. Only if you go to that posting itself, will the language be correctly set. But this can be solved in a similar way, I assume. [UPDATE 2019-10-14] I’ve also edited the index.php and category.php templates to check if a posting is in the Dutch or German language category, and add a language declaration using a <div lang="nl-nl"> around the posting. For the index.php I do that only for the home page. This works, but as far as I can tell e.g. Google Translate for ‘detect language’ only checks the default language of a page. As I am not here to facilitate Google, I am currently satisfied that I at least do now provide clear meta-data about the language of postings I publish.[/UPDATE]
A final step I’d like to add is automatically insert machine translation links into my rss feed items, although I’m still not entirely sure that would be useful.

Also see Adding Better Language Support II and Adding Better Language Support III