It's better when it's simple

User Tools

Site Tools


WikipediaSnippet Plugin

Compatible with DokuWiki

  • 2023-04-04 "Jack Jackrum" yes
  • 2022-07-31 "Igor" yes
  • 2020-07-29 "Hogfather" yes
  • 2018-04-22 "Greebo" unknown

plugin Includes a snippet from a Wikipedia article.

Last updated on

Tagged with include, wikipedia

Download and Installation

Search and install the plugin using the Extension Manager. Refer to Plugins on how to install plugins manually.

Syntax and Usage

The syntax is very simple:


It's intentional that it's similar to the interwiki link: [[wp>Article_Name]]

The difference is that

  • it includes the first paragraphs of the according Wikipedia page and
  • it uses automatically the language of the wiki (lang)

If you'd like to use a different language than the language of the wiki page, you can add the according language code as another parameter, e.g. the French article for “DokuWiki” would need:


{{wp>DokuWiki}} will look like this (in the default template with default configuration):


  • snippetLength (default: 0): Number of sentences to show per snippet; leave empty or '0' to show the whole intro section
  • useHtml (default: 1): Display HTML formatting in the snippet? (otherwise display unformatted text only)
  • includeTables (default: 0) will include tables, e.g. the usual infobox. This can make the snippet more interesting, but some infoboxes can also get unproportionately big and will look strange. removed in latest version
  • includeImages (default: 0) will include all images that appear within the first few paragraphs and tables. If you enable this, please set your fetchsize config option, so that external images will automatically be cached by DokuWiki. (The HTML will get cached anyway.) removed in latest version



Remove disambiguation notice

I realize this is the wrong place but Github is throwing a server error @ the above link:

Many topics have disambiguation pages:
includes before 1st paragraph:

This article is about virtual user representations. For other uses, see avatar (disambiguation).

in the source as:

<div class="dablink">This article is about virtual user representations.  For other uses, see <a href="/wiki/Avatar_(disambiguation)" title="Avatar (disambiguation)">avatar (disambiguation)</a>.</div>

It would be really nice to have these eliminated, as with this plugin we already know that we want this particular page.

–Jeff 2010-04-25

Yes, that makes sense. I just removed the disambiguation link as you suggested in the latest version. — Anika Henke 2010/06/12 17:48


I've installed the wikipediasnipped plugin, but instead of a text snippet from the WP article, I see only something like:

Object id #94 

The link from the snippet title still forwards to the correct WP article, however.

–Andrew 2010-10-25

It's difficult to help without further information. I just released a new version which includes some (hopefully helpful) error message which will help you to debug the problem. — Anika Henke 2011/05/29 16:24


Is this plugin useful ?


chtiland 2011-04-24

I guess, as with any other plugin: To some people it is useful, to others it isn't. This plugin doesn't do the same as interwiki links. It doesn't just display the link, but also fetches the first paragraph of the article. — Anika Henke 2011/05/29 16:24
To me, this plugin really is useful. I add it at the end of some of my articles on my website (check out here for example) , as a way to dig further on the topics I dealt with. I could just add a link inside the article itself, but I find this plugin more pleasant to the eyes than a simple link, it's more obvious and more knowledge is instantly accessible to the reader! Only thing I'd like to see in a next release is a way to specify the maximal amount of text to retrieve from the Wikipedia page and to include in the snippet, so that a snippet don't take too much space. — Grégory Gutierez 2012/01/10, 11:54

Problem, Language: de-informal

… doesn't work with dokuwiki's custom lang-ids: This does not exist.

I think this plugin should work according to the interwiki entries: “wp” looks up Englisch entries, “wpde” looks up German entries etc. But it does not. Why?

I just fixed that. It does work like the interwiki entries, but “wpde-informal” obviously doesn't exist, so you cannot really compare it. As “de-informal” is not an officially recognised language code, I implemented it so it gets substituted with “de” (and the same is true for some other non-standard language codes). Please update your plugin to make it work. — Anika Henke 2012/08/19 14:23

Problem with images that start with "//"

I've a problem with pages like that have an image in the snippet: the image is of the form <img src="//..." that is an absolute link. On Wikipedia it works, of course, but when processed by Dokuwiki it becomes a (broken) relative link.

I propose this fix: to add at line 102 of syntax.php the following code:

  // <img src="//.." becomes <img src="http://.."
  $text = str_replace('src="//', 'src="http://' , $text);

It works! On my own system at least ;-).


I have fixed this in the latest version. However, I also changed the way the articles are retrieved, which (probably) got rid of images altogether. — Anika Henke 2013/04/06 23:54
Why do you have removed images? I made the example of the page because here an image (two logic formulas) is an essential part of the info! - Fabrizio
I didn't deliberately remove images. But the plugin uses a different API functionality which just doesn't support any images. So, it was collateral damage I was willing to take as this new functionality is otherwise much better. I just checked and they still don't support images with it. More information regarding this specific change.Anika Henke 2016-04-07 19:21

A syntax {{wpXX>}} to select a specific Wikipedia site?

Another proposal: I like that the syntax {{wp>page name}} automatically uses the default wiki language: I have a wiki site in italian language and in 99% of the circumstances I would like to show a snippet from an italian Wikipedia page. But in a few circumstances I would like to show a snippet from an English Wikipedia page too!

So my proposal is to add a second syntax {{wpXX>page name}} where XX stands for the language (it/en/de etc..).


P.S.: good plugin, really! one of my best favorites

Thanks, I have implemented this, but with a slightly different syntax: {{wp:it>page name}}. — Anika Henke 2013/04/06 23:54
Ok! Good :-)Fabrizio

Issues running locally

Hello Anika. Really nice plugin. But this plugin doesn't work in local modi. When i'm using it on localhost ( with apache there is the error: “Error: Fetching the article from Wikipedia failed. Could not connect to php_network_getaddresses: getaddrinfo failed: Der angegebene Host ist unbekannt (0).” Internet connection is active. What i have to do? Thanks in advance.

–Marcus 2013/07/02

»useHtml-switch not working

I always have HTML-wikisnippets. I can uncheck the option in the configuration menu, it also stays unchecked, but it does not have any effect. I always have the HTML-snippets.

Is there anything I could do or try?

Otto 2015/01/30 14:10

It works for me as intended. Can you give an example syntax which doesn't work? And can you also describe what you expect to see instead? — Anika Henke 2016-04-07 19:21
plugin/wikipediasnippet.txt · Last modified: 2023-10-30 22:09 by Klap-in

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki