mediawiki-extensions-Descri.../extension.json
alex4401 c146909532
Truncate descriptions to a certain length
With this change, generated descriptions are cut at 300 characters, without breaking words when possible, and with an ellipsis added in case the cut happened mid-sentence.

The `Description2::getFirstChars` function was borrowed from TextExtracts with minor alterations (added comment for their regex, and removed `>` from word healing given it's unclear why it's been included).

New configuration variable `$wgDescriptionMaxChars` (proposed default: 300, which seems like a sensible amount) controls this behaviour.

This has been in testing on ark.wiki.gg (with the platform's approval, which I'm glad for) since early September. Without this change, we had a few pages with little sections having a huge part of their body text thrown into the `description` meta tag...

Depends-On: I585f2c0046571310aad67f3ba148c4f22aaae49f
Change-Id: I04b00f99085f07f773212ee3eca8470eece34e9e
2024-02-24 08:44:53 +01:00

51 lines
1.1 KiB
JSON

{
"name": "Description2",
"version": "0.4.1",
"author": [
"[http://danf.ca/mw/ Daniel Friesen]"
],
"url": "https://www.mediawiki.org/wiki/Extension:Description2",
"descriptionmsg": "description2-desc",
"license-name": "GPL-2.0-or-later",
"type": "other",
"requires": {
"MediaWiki": ">= 1.35.0"
},
"config": {
"EnableMetaDescriptionFunctions": false,
"DescriptionMaxChars": 300
},
"ConfigRegistry": {
"Description2": "GlobalVarConfig::newInstance"
},
"ServiceWiringFiles": [
"includes/ServiceWiring.php"
],
"AutoloadNamespaces": {
"MediaWiki\\Extension\\Description2\\": "includes/"
},
"ExtensionMessagesFiles": {
"Description2Magic": "Description2.i18n.magic.php"
},
"MessagesDirs": {
"Description2": [
"i18n"
]
},
"HookHandlers": {
"Description2": {
"class": "MediaWiki\\Extension\\Description2\\Hooks",
"services": [
"ConfigFactory",
"Description2.DescriptionProvider"
]
}
},
"Hooks": {
"OutputPageParserOutput": "Description2",
"ParserAfterTidy": "Description2",
"ParserFirstCallInit": "Description2"
},
"manifest_version": 1
}