Working With MediaWiki
it just has to connect with the MediaWiki API, which does the actual work of writing and reading data. Most of the major programming languages have one or more MediaWiki API libraries written for them, which take care of the details of logging in to the wiki and connecting to the API. But even without a library, it’s not that hard to create a MediaWiki bot — the script just needs to hit some MediaWiki URLs.
If a bot makes any edits on a wiki, it should ideally be logged in as a user — and ideally that user should be a separate account, which gets added to the "bots" group. You can see these kinds of accounts all over Wikipedia — they’re the ones fixing broken
tags, renaming categories, adding signatures to unsigned talk-page messages, etc. On other wikis, they’re quite a bit less common, but some smaller wikis do make significant use of them.
This page holds some information, and helpful links, on creating and running bots:
https://www.mediawiki.org/wiki/Manual:Bots
TheMediaWiki API
The MediaWiki API is essentially a set of URLs that one can access in order to read from and write to the wiki. They all involve different parameters passed in to the file api.php. That file is located in the same directory as index.php; so, for instance, if your wiki has URLs of the form mywiki.com/w/index.php?title=..., the main API URL can be found at mywiki.com/w/api.php. (For more recent versions of MediaWiki, the API is linked from the Special:Version page.)
If you go that main URL, you’ll see a fairly exhaustive (automatically generated) explanation of all the API actions available. API actions are defined by both core MediaWiki and a number of extensions. You’ll also see a listing of the different formats that the results can be displayed in, including JSON and XML. For example, adding "format=jsonfm" to the URL will display results in a pseudo-JSON format that users can read on the screen, while "format=json" will result in actual raw JSON.
We won’t get into the details of all the API functionality available here, but you can see it at api.php — and you can also read more about it at:
https://www.mediawiki.org/wiki/API:Main_page
Search engine optimization
Search engine optimization, or SEO, is the practice of attempting to get the pages of one’s web site to show up as high as possible in search-engine results, most notably on Google. It’s a controversial field: to its proponents, it’s an indispensable way to get web traffic, while to its detractors, it’s at best tacky, and at worst the domain of hucksters, spammers and scammers. Nevertheless, for people who run public wikis, showing up high in search results can be important.
First of all, MediaWiki is already well-geared for doing well in search results in a number of ways. Wikipedia, which is of course MediaWiki-based, is the number one best-performing site for search results, by any metric: it’s usually in the top three, and often #1, for a search on any topic it covers. That’s mostly just because it gets linked to so often from other sites about those specific topics, but it’s also in part due to MediaWiki’s own design.
In MediaWiki, the subject of every page is also: the page’s name, a part of its URL, the text in the top-level header, and the text that shows up in internal links to that page. That sort of consistency is extremely important for search engines in associating that word or phrase with that specific URL. Tied in with that, there’s usually only one top-level header per page: the name of the page is contained within the only tag on the page, which is another thing that helps to establish the page’s subject for search engines.
There is at least one active MediaWiki extension that can potentially help with search-engine rankings: the extension WikiSEO, which adds to the and tags of a wiki page’s HTML source code. It defines a parser function, appropriately named “#seo”, which can be added anywhere to the page, and which is called in the following way:
{{#seo: title=... | titlemode=... | keywords=... | description=... }}
The “
title=
” parameter either replaces, is appended or prepended to the contents of the HTML tag, depending on the value of the
“titlemode=
” parameter, which can be either
replace
,
append
or
prepend
. The
“keywords=
” and “
description=
” parameters get placed as the “name” and “content” attributes, respectively, of an HTML
Weitere Kostenlose Bücher