Extension:MetaDescriptionTag

From mediawiki.org
This page is a translated version of the page Extension:MetaDescriptionTag and the translation is 62% complete.
Справка по расширениям MediaWiki
MetaDescriptionTag
Статус релиза: стабильно
Реализация Тег
Описание Provides a tag for adding a custom ‎<meta> description to the document's ‎<head>
Автор(ы) Dror S., Joshua C. Lerner (original author)
Последняя версия 0.4.0 (2017-05-22)
MediaWiki 1.25+
Изменения в БД Нет
Лицензия MIT License
Скачать
см. ниже
‎<metadesc>

The MetaDescriptionTag allows users to add a ‎<meta> description into a page's ‎<head>.

Установка

  • Скачать и распакуйте файл(ы) в папку с названием MetaDescriptionTag в вашей папке extensions/.
  • Добавьте следующий код в конце вашего файла LocalSettings.php :
    wfLoadExtension( 'MetaDescriptionTag' );
    
  • Yes Готово – Перейдите на страницу Special:Version на своей вики, чтобы удостовериться в том, что расширение успешно установлено.

Использование

После инсталляции пользователи твоей Вики смогут добавлять ‎<meta> описания на страницах с помощью следующего викитекста:

<metadesc>PageDescription</metadesc>

Тут PageDescription надо заменить на нужное мета описание.

For example, the above would become:

<meta name="description" content="PageDescription" />

Usage through a template

Say for example you want use a template to set the meta description to something like:

<metadesc>Extract from the article ARTICLETITLE</metadesc>

Создайте шаблон с названием (например) "Шаблон:Metadesc" со следующим содержанием:

{{#tag:metadesc | Extract from the article {{{1}}} }}

Если вам нужно добавить описание похожее на:

{{metadesc|{{PAGENAME}} }}

Changelog

0.4.0

This is re-write to make it compatible with more modern MediaWiki practices and make sure it works nicely with MediaWiki 1.27+:

  • Extension Registration (extension.json)
  • json i18n files - An actual README file! :-)
  • Switching to semantic versioning.
0.3

Fix i18n to work with v1.16+, sanitize output using htmlspecialchars().

0.2

Change syntax to <metadesc>some content</metadesc> to support template variable substitution.

0.1

Initial release.

См. также