blog

archives

Using Discourse as a community-powered wiki

Erlend Sogge Heggen May 3, 2016

The following is a guest post by Sam Nazarko, CEO and founder of OSMC.tv

Are you using Discourse in a novel way? If you’re interested in writing a guest post like this one, please get in touch.

In 2014, I started working on a new project, OSMC (Open Source Media Center). OSMC is a free and open source media player based on Linux that lets you play back media from your local network, attached storage and the Internet.

osmc-frontpage

 

As the project started to accumulate users, we wanted to help the newcomers as much as possible and ensure that they could get the resources they wanted. The need for a Wiki became abundantly clear but I wasn’t sure that popular Wiki software was the best fit for us. For a while we worked on our own GitHub based Wiki system. GitHub had a markdown editor, but it still left a lot to work out for newcomers and the process wasn’t as smooth as we had expected.

After some thought, we realised that Discourse had everything we wanted. Users familiar with posting and the WYSIWYG editor would be able to edit or add to the Wiki without any additional learning curve, and they wouldn’t need to hold an additional account on an external Wiki site. Mark Theis (OSMC’s web developer) and I got to work. By the end of the day, we had a Wiki category in Discourse and some basic scripts that scraped this forum category every half hour and published the pages on our website as static HTML. We scrape Discourse via the Discourse REST API and build templates for our blog.

omsc-wiki

 

It’s working well. Edits are easily trackable, and Discourse’s permission system ensures we have fine control over edits on the website. The new implementation is also very fast, as we build the Wiki pages as static HTML and cache them. Discourse has already proven its ability to handle large numbers of posts, so unlike other Wiki software, I’m not concerned about performance problems as the Wiki scales.

There is certainly room for improvement with our Wiki. We scrape each post from the Wiki category and get the post content as JSON. This JSON contains pre-formatted HTML. In the future, it would be good to be able to access the post as Markdown and have more control over the styling of the content. Editing posts is simple enough, but adding new categories or new articles is still a little too complex for some users, and this is something we’d like to simplify in the future.

The Wiki needs a lot of work, but we’re glad to have implemented something stable and easy to use that will last for many years to come. We are now looking at using Discourse to power our new Newsletter system for the same ease of editing and great durability.

You can get the source code here: (updated)

  1. https://github.com/osmc/website/tree/master/server/modules/wiki

Notable Replies

  1. this is pretty awesome! I might try this out on a new project, but just a heads up, the github links are dead. looks like the repo was refactored, so now the links are here:

    wiki.js

    wiki.php - now a module
    https://github.com/osmc/website/tree/master/server/modules/wiki

    is it possible to get Sam (or someone from OSMC) to put together a little how-to on using their Wiki code?

  2. awesome - thanks @marktheis! as an aside - is the site css based off a framework, or completely custom? I noticed you guys use express/ghost/normalize.css - wasn't sure if the rest was built from scratch or used something a la Susy or Bourbon as a starting point. either way, I love the design!

  3. css is completely custom. Frameworks are nice, but I always end up fighting the framework. And they're usually too big for my taste.

    Yes apart from express, ghost, and a few js/css modules everything (server/client) is built from scratch.

    With a website that depends on a lot of external services (discourse for wiki and comments, woocommerce for shop, another server for diskimages) I think that node with express and handlebars templates works really well.

    Btw. I'm also currently building an email system that takes posts from discourse, and turns them into ready and processed emails via Foundation for Emails. To be consumed by phplist. Yes I really don't like phplist's html editor :smile:

  4. Interlinking: if you mean canonical urls then no. We find that google prioritises osmc.tv/wiki over discourse for us, so I haven't made any changes there. (It's not that important for us atm).

    categorization: Yes each wiki post is in a category our discourse and site.

    Tagging: No. We don't use the tag plugin.

  5. Been a bit busy lately, here's the short version.

    The gist of it is to arrange it properly in discourse.
    We have a main table of contents (toc) post with links to each category toc that then have all the posts listed for that category.

    So for us it's:

    Main toc post with links to all the category posts:

    > general
    > vero
    > pi

    And then in the general post e.q.

    > FAQ
    > how to
    > get started

    So via the discourse api you get the main toc. loop the category links, then you loop the post links and get the title and body.

    We then write the whole thing to a single json file for easy use.

    So when you go to https://osmc.tv/wiki/general/frequently-asked-questions/

    It looks if "general" exists in the json file, and then after that it looks up the title of the post. If that also exists it renders the page with that content.

    Hope that helps :slight_smile:

Continue the discussion meta.discourse.org

6 more replies

Participants