Help:Extension:Discourse

The Discourse extension provides a Lua library with which to interact with an external Discourse forum. Users of the extension are expected to already be familiar with writing templates and modules.

The extension provides the following two functions that expose the basic functionality for fetching any data that is available via the Discourse API:


 * — Get data from a Discourse site.
 * Site short name (as defined by the wiki system administrator).
 * The URL path of a JSON endpoint. See the Discourse documentation for full details.
 * Whatever is returned by the Discourse API, or error information.
 * — Get the base URL of a given Discourse site. Useful for constructing links in templates etc.
 * Site name.
 * With 'result' key.

The  library also provides two 'example' functions that can be used as-is or serve as the basis for a wiki's own formatting etc.

An example of a  that uses these could look something like the following:

This could then be used within a template with the following wikitext:

The details of the  and   functions can be viewed in the discourse.lua source file.