-
Task
-
Resolution: Done
-
Medium
-
None
Summary
We want, for pages @ https://docs.moodle.org/dev that already have been migrated to the new https://moodledev.io to be able to do a couple of thigs:
- We want to be able to add the rel=canonical tag, so search engines and other start indexing the new dev docs pages instead of the old ones.
- We want to be able to add the meta=refresh tag, so anybody visiting the old page is automatically redirected to the new one.
To achieve this, the CarenodiMW mediawiki extension has been created.
Actions
- Install the extension to be enabled for dev docs (if possible, only for dev docs, not needed for user docs).
- Configure it as follows. Note that the configuration only enables the rel=canonical tag, so search engines will start to be aware of the new docs. We'll enable the automatic redirects (meta=refresh in a (near) future.
// Load the CarenodiMW extension
if (file_exists("$IP/extensions/CarenodiMW/extension.json")) {
wfLoadExtension('CarenodiMW');
// Register the config.
$wgConfigRegistry['CarenodiMW'] = 'GlobalVarConfig::newInstance';
// Base URL to be used for all the canonical and refresh tags.
$wgCarenodiMW_base = 'https://moodledev.io';
// Regular expression to extract the path for the canonical tags.
$wgCarenodiMW_canonical_regexp = '/\{\{Template:Migrated\|newDocId=(.*)\}\}/';
// Regular expression to extract the path for the refresh tags.
$wgCarenodiMW_refresh_regexp = ''; // Disabled for now.
// Number of seconds to perform the refresh to new URL (0 = immediate).
$wgCarenodiMW_refresh_wait = 0;
}
- Verify that it's working as expected:
- Visit any page in mediawiki dev docs that has been already migrated to the new system (so it has the "This content of this page has been updated and migrated..." notification on top).
- Examine its HTML.
- Verify that it has a rel=canonical link in the <head> element pointing to the new docs. It should look like this:
<html>
...
<head>
...
<link rel="canonical" href="https://moodledev.io/NEW/PATH/GOES/HERE">
...
- Verify that the URL exists in the new dev docs system and corresponds with the original @ Mediawiki.
- Visit any page that has NOT been migrated yet.
- Examine its HTML.
- Verify that it DOES NOT contain any rel_canonical link.
- has to be done before
-
MDLSITE-7363 Enable redirections in mediawiki dev docs
-
- Resolved
-