Using Discourse as a community-powered wiki

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…


This topic is for comments on the original blog entry at: http://blog.discourse.org/2016/05/using-discourse-as-a-community-powered-wiki/

12 Likes

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
https://github.com/osmc/website/blob/master/src/assets/js/modules/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?

3 Likes

Hi. Yeah I’ve been refactoring a bit :slight_smile:.

All the server side code is now here:
https://github.com/osmc/website/tree/master/server/modules/wiki

Wiki.js is just a very basic search feature you can see live on https://osmc.tv/wiki (at this point all the wiki data is being served server-side).

It’s a bit of a convoluted/hack’ish setup, so it’s probably a bit tricky to follow without knowing the flow. I’ll make a guide soon :slight_smile:

6 Likes

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 Likes

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:

3 Likes

Do these custom scripts handle interlinking, categorization and tagging in any way?

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.

Thanks for the info.

I mean, if one topic links to another, will the links in the corresponding wiki post direct to the target wiki post?

Not it won’t. We insert links to the target wiki post manually.

Any progress on the wiki guide? I’m not using Express, but I’m hoping that I can use Sage’s routing features with just a little bit of hacking.

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 :)
2 Likes

Btw, an offtopic thought: I suppose it is possible to make a simple one-page JS application that would use Discourse API only, some React / Angular client-side and some configuration file server-side to make a fully-functional wiki site that would fetch all the data from Discourse automatically.

However, I think, such a feature will eventually become just part of Discourse with custom templating per category and custom front page.

Yep, this is something we might do, as discussed here:

2 Likes