Skip to content

Add the rel=canonical and/or the meta=refresh tags to Mediawiki articles matching some regexps.

License

Notifications You must be signed in to change notification settings

stronk7/CarenodiMW

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CarenodiMW

CarenodiMW is a mediawiki extension that adds the rel=canonical and the meta=refresh tags to pages which wikitext matches a regexp-based configuration.

Note that this extension manages both features as HTML tags, not as HTTP headers.

Installation

  • Current version requires MediaWiki >=1.39. Use release v0.99.2 for MediaWiki >=1.31 <1.36.
  • Download and unzip it (or clone this git repo).
  • Copy the folder as CarenodiMW within the extensionsdirectory of your mediawiki site.

Usage

Enable the extension

Edit LocalSettings.php and add the following, configuring the settings to suit your needs.

wfLoadExtension('CarenodiMW'); // Load me!

// Base URL to be used for all the canonical and refresh tags.
$wgCarenodiMW_base = 'https://example.com';

// Regular expression to extract the path for the canonical tags.
// The first captured group in the regular expression will be used.
// Any empty value disables the feature globally.
$wgCarenodiMW_canonical_regexp = '/new location is (.*) this/';

// Regular expression to extract the path for the refresh tags.
// The first captured group in the regular expression will be used)
// Any empty value disables the feature globally.
// (note that, normally, it will be the same than the canonical one
// but it's possible to specify different one).
$wgCarenodiMW_refresh_regexp = '/new location is (.*) this/';

// Number of seconds to perform the refresh to new URL (0 = immediate).
$wgCarenodiMW_refresh_wait = 5;

// Enable separate debug for the extension
// $wgDebugLogGroups['CarenodiMW'] = '/tmp/CarenodiMW.log';

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License and copyright

BSD 3-Clause - Copyright (c) 2022 onwards, Eloy Lafuente (stronk7).

About

Add the rel=canonical and/or the meta=refresh tags to Mediawiki articles matching some regexps.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages