SemanticMediaWiki / SemanticMetaTags

Allows to generate HTML <meta> elements from semantic annotations
https://www.semantic-mediawiki.org/wiki/Extension:Semantic_Meta_Tags
Other
12 stars 6 forks source link

Feature request: Allow callable fallbacks for $smtgTagsProperties #61

Closed alex-mashin closed 4 years ago

alex-mashin commented 4 years ago

Proposal: if $smtgTagsProperties['tag name'] or $smtgTagsProperties['tag name'][some index] is callable, call it, passing OutputPage &$out and perhaps ParserOutput $parserOutput to it, and assign the return, if it does not evaluate to false, to the meta tag.

Reason: property values are not always set, but a non-semantic fallback can often be found. However, this fallback value should usually depend on the current page and localised messages, and trying to access both from LocalSettings.php gives horrible results, to the point of effectively breaking MediaWiki.

This feature can totally replace $smtgTagsStrings, also resolving #60.

kghbln commented 4 years ago

Thanks for creating the issue.

also resolving #60.

This assumes that something is set to the meta element, e.g. description, I guess. Thus I still need to set it somehow?

alex-mashin commented 4 years ago

I am not sure if I understand your question correctly. An example of a callback "property" assigned to a metatag can be seen in the commit message to my pull request #62, which you are kindly invited to review. A callback function can return string constants as well, making $smtgTagsStrings redundant, and, in combination with the $smtgTagsPropertyFallbackUsage = true setting, it can achieve your goal in #60.

alex-mashin commented 4 years ago

Is this extension still maintained?

alex-mashin commented 4 years ago

Anybody at home?

kghbln commented 4 years ago

@alex-mashin Will do a release soon, probably later this day. Thanks a lot!