Extension:Description2/pl
Description2 Status wydania: stabilne |
|
---|---|
Realizacja | Wydobywanie danych, Rozszerzenie parsera |
Opis | Provides a meta description tag and adds data to parser output for other extensions to use. |
Autor(zy) | Daniel Friesen (Dantmandyskusja) |
Ostatnia wersja | 0.4.1 |
Polityka zgodności | Master utrzymuje kompatybilność wsteczną. |
MediaWiki | >= 1.38.0 |
Zmiany w bazie danych | Nie |
Licencja | Licencja GNU General Public License 2.0 lub nowsza |
Pobieranie | |
|
|
Quarterly downloads | 46 (Ranked 90th) |
Przetłumacz rozszerzenie Description2 jeżeli jest dostępne na translatewiki.net | |
The Description2 extension adds a description meta tag for articles automatically based on the content. This functionality appears to have been removed from MediaWiki at some point. There are some situations where description extraction (by entities less sophisticated than Google, like Facebook) will extract the wrong description information from the wiki and use something like the sitenotice as the description for a page instead of its content. This extension also adds the description to the parser output in a way that other extensions can make use of (to say provide description in a different format like Extension:OpenGraphMeta does, or perhaps to use it in article lists on the wiki).
Instalacja
- Pobierz i umieść plik(i) w katalogu o nazwie
Description2
w folderzeextensions/
.
Developers and code contributors should install the extension from Git instead, using:cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/Description2 - Dodaj poniższy kod na dole twojego pliku LocalSettings.php :
wfLoadExtension( 'Description2' ); $wgEnableMetaDescriptionFunctions = true;
- Zrobione – Przejdź do Special:Version na twojej wiki, aby sprawdzić czy rozszerzenie zostało pomyślnie zainstalowane.
Ekstra opcje
If you set $wgEnableMetaDescriptionFunctions = true;
in your LocalSettings.php a {{#description2:}}
parser function can be used to control the description outputted for the page and override it with a custom one.
You can use these parser extensions like so:
{{#description2:This is a description}}
You can use the description2 parser function instead to provide a description tag you can control with a template's variables.
Algorytm
Description is extracted from the HTML representation of a page:
- Remove all
<table>
elements (and its contents). - Find all
<p>
elements. - Iterate over those paragraphs, stripping out all HTML tags (see strip_tags()) and trimming whitespace around it.
- The first non-empty paragraph (after all previous transformation) is picked as the description.
Things to consider:
- When using templates at the top of the articles, if you use
<div>
instead of tables for the template, be sure it doesn't render paragraphs, which otherwise will be used as the description. This may happen if you have several<div>
inside the template with newlines.
Zobacz też
- Extension:OpenGraphMeta – uses Description2's description information when installed.
- Extension:MetaDescriptionTag
- Extension:Semantic Meta Tags
To rozszerzenie jest dołączone do następujących farm/hostów wiki lub pakietów: To nie jest pełna lista. Niektóre farmy/hosty wiki lub pakiety mogą zawierać to rozszerzenie nawet jeśli nie są one tutaj wymienione. Zawsze sprawdzaj swoje farmy/hosty wiki, aby to potwierdzić. |
- Stable extensions/pl
- Data extraction extensions/pl
- Parser extensions/pl
- GPL licensed extensions/pl
- Extensions in Wikimedia version control/pl
- OutputPageParserOutput extensions/pl
- ParserAfterTidy extensions/pl
- ParserFirstCallInit extensions/pl
- All extensions/pl
- Extensions included in Canasta/pl
- Extensions included in Miraheze/pl
- Extensions included in wiki.gg/pl
- Extensions included in WikiForge/pl
- HTML head extensions/pl
- Search engine optimization extensions/pl