Skip to content

Commit

Permalink
Release version 3.0.0 (#65)
Browse files Browse the repository at this point in the history
* Provide release notes 
* Fluff howto readme
* Update and tweak general readme
* Increment version
  • Loading branch information
kghbln authored Sep 26, 2020
1 parent 938e25e commit 105133e
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 26 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@
[![Packagist download count](https://poser.pugx.org/mediawiki/semantic-meta-tags/d/total.png)](https://packagist.org/packages/mediawiki/semantic-meta-tags)

Semantic Meta Tags (a.k.a. SMT) is a [Semantic Mediawiki][smw] extension to enhance
the meta tags of an article with content generated from semantic annotations.
the meta element of a page with content generated from semantic annotations.

This extension enables to automatically extend the HTML `<meta>` tags of an article
This extension enables to automatically extend the HTML `<meta>` elements of a page
with content generated from selected properties to create:

- Standard tags (e.g `meta name="keywords"`) as well as
- Standard meta elements (e.g `meta name="keywords"`) as well as
- [Summary card][tw] and [Open Graph][opg] protocol tags (e.g `meta property="og:title"`)

## Requirements

- PHP 5.6 or later
- MediaWiki 1.27 or later
- [Semantic MediaWiki][smw] 3.0 or later
- PHP 7.1 or later
- MediaWiki 1.31 or later
- [Semantic MediaWiki][smw] 3.1 or later

## Installation

The recommended way to install Semantic Meta Tags is using [Composer](http://getcomposer.org) with
[MediaWiki's built-in support for Composer](https://www.mediawiki.org/wiki/Composer).

Note that the required extension Semantic MediaWiki must be installed first according to the installation
instructions provided.
instructions provided for it.

### Step 1

Expand All @@ -37,15 +37,15 @@ create one and add the following content to it:
```
{
"require": {
"mediawiki/semantic-meta-tags": "~2.0"
"mediawiki/semantic-meta-tags": "~3.0"
}
}
```

If you already have a "composer.local.json" file add the following line to the end of the "require"
section in your file:

"mediawiki/semantic-meta-tags": "~2.0"
"mediawiki/semantic-meta-tags": "~3.0"

Remember to add a comma to the end of the preceding line in this section.

Expand Down
11 changes: 11 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
This file contains the RELEASE-NOTES of the **Semantic Meta Tags** (a.k.a. SMT) extension.

### 3.0.0

Released on September 26, 2020.

* Minimum requirement for
* PHP changed to version 7.1 and later
* MediaWiki changed to version 1.31 and later
* Semantic MediaWiki changed to version 3.1 and later
* [#61](https://github.com/SemanticMediaWiki/SemanticMetaTags/issues/61) Adds support for fallback strings to be used if no annotation is present
* Localization updates from https://translatewiki.net

### 2.0.0

Released on January 29, 2019.
Expand Down
7 changes: 3 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mediawiki/semantic-meta-tags",
"type": "mediawiki-extension",
"description": "A Semantic Mediawiki extension to add meta tags with content generated from semantic annotations.",
"description": "An extension to Semantic Mediawiki to add meta elements with content generated from semantic annotations.",
"keywords": [
"smw",
"semantic mediawiki",
Expand All @@ -22,13 +22,12 @@
"support": {
"email": "[email protected]",
"issues": "https://github.com/SemanticMediaWiki/SemanticMetaTags/issues",
"irc": "irc://irc.freenode.net/semantic-mediawiki",
"forum": "https://www.semantic-mediawiki.org/wiki/semantic-mediawiki.org_talk:Community_portal",
"wiki": "https://www.semantic-mediawiki.org/wiki/",
"source": "https://github.com/SemanticMediaWiki/SemanticMetaTags"
},
"require": {
"php": ">=5.6",
"php": ">=7.1",
"composer/installers": "1.*,>=1.0.1",
"mediawiki/semantic-media-wiki": "~3.1"
},
Expand All @@ -39,7 +38,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "2.x-dev"
"dev-master": "3.x-dev"
}
},
"autoload": {
Expand Down
65 changes: 53 additions & 12 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ and annotated using the `meta property=""` description.
by commas.
* callback is a function that ought to have the following signature:
`function( OutputPage $outputPage ): string`. This is the place to assign
MediaWiki messages, page properties like its title or plain strings to tags.
MediaWiki system messages, page properties like its title or plain strings to tags
* `$GLOBALS['smtgTagsPropertyFallbackUsage']` in case it is set `true` then the
first property that returns a valid content for an assigned tag will be used
exclusively.
Expand All @@ -35,6 +35,41 @@ and annotated using the `meta property=""` description.

### Example settings

#### Simple settings
Best for wikis using templates on all content pages
```php
$GLOBALS['smtgTagsProperties'] = [

// Standard meta tags
'keywords' => [
'Has keywords', 'Has another keyword'
],
'description' => 'Has some description',
'author' => 'Has last editor',

// Summary card tag
'twitter:description' => 'Has some description',

// Open Graph protocol supported tag
'og:title' => 'Has title'
];

$GLOBALS['smtgTagsStrings'] = [

// Static content tag
'some:tag' => 'Content that is static'
];

$GLOBALS['smtgMetaPropertyPrefixes'] = [

// Open Graph prefixes
'og:',
'fb:'
];
```

#### Advanced settings
Best for wiki not using templates on all content pages
```php
$GLOBALS['smtgTagsProperties'] = [

Expand All @@ -52,17 +87,21 @@ $GLOBALS['smtgTagsProperties'] = [
return implode( ', ', array_unique( $redirect_titles ));
}
],
'description' => ['Has some description', function( OutputPage $outputPage ): string {
/* This example generates a fallback description for a page:
* for the main page, the site name from the message MediaWiki:pagetitle-view-mainpage,
* for other pages, page title, followed by subtitle from MediaWiki:Tagline.
*/
global $wgLanguageCode;
$title = $outputPage->getContext()->getTitle()->getText();
$main_page = wfMessage( 'mainpage' )->inLanguage( $wgLanguageCode ?: 'ru' )->escaped();
$site_name = wfMessage( 'pagetitle-view-mainpage' )->inLanguage( $wgLanguageCode ?: 'ru' )->escaped();
$subtitle = $title !== $main_page ? wfMessage( 'tagline' )->inLanguage( $wgLanguageCode ?: 'ru' )->escaped () : '';
return $title === $main_page ? $site_name : $title . '. ' . $subtitle;
'description' => [
'Has some description',
function( OutputPage $outputPage ): string {
/**
* This example generates a fallback description for a page:
* - for the main page, the site name from the message "MediaWiki:Pagetitle-view-mainpage",
* - for other pages, page title, followed by subtitle from "MediaWiki:Tagline".
* The language specified, e.g. 'ru' should match the language of your wiki's language
*/
global $wgLanguageCode;
$title = $outputPage->getContext()->getTitle()->getText();
$main_page = wfMessage( 'mainpage' )->inLanguage( $wgLanguageCode ?: 'ru' )->escaped();
$site_name = wfMessage( 'pagetitle-view-mainpage' )->inLanguage( $wgLanguageCode ?: 'ru' )->escaped();
$subtitle = $title !== $main_page ? wfMessage( 'tagline' )->inLanguage( $wgLanguageCode ?: 'ru' )->escaped() : '';
return $title === $main_page ? $site_name : $title . '. ' . $subtitle;
}],
'author' => 'Has last editor',

Expand All @@ -73,6 +112,8 @@ $GLOBALS['smtgTagsProperties'] = [
'og:title' => 'Has title'
];

$GLOBALS['smtgTagsPropertyFallbackUsage'] = true;

$GLOBALS['smtgTagsStrings'] = [

// Static content tag
Expand Down
2 changes: 1 addition & 1 deletion extension.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "SemanticMetaTags",
"version": "2.1.0-alpha",
"version": "3.0.0",
"author": [
"James Hong Kong"
],
Expand Down

0 comments on commit 105133e

Please sign in to comment.