Building a Dokuwiki Injector Extension: Enhancing Web Searches with Personal Knowledge

Ever wished you could seamlessly integrate your personal knowledge base with web searches? Meet my Dokuwiki Injector Extension. I absolutely love Dokuwiki. I have over a thousand pages filled with all kinds of information - ranging from science-stuff to recipes and favourite teas. I use my wiki for information I need once in a while, but not often enough to actually remember. The problem is - as it often is in knowledge repositories - that it is kinda hard to remember what is in the wiki and what is not. This extension will hopefully make that a little easier.

Inspiration

In the past I used the excellent Linkding injector plugin, which is simple, but surprisingly useful. Linkding is a way of storing your bookmarks, and the only thing the Linkding injector does is show results from your bookmarks in search engine results from Google/DuckDuckgo/Kagi/whatever.

My idea was simple: what if, when you search the web, you could also search your Dokuwiki instance? Imagine searching for a dish and seeing both web results and the Dokuwiki page you wrote two months ago (and you have forgotten about by now. Or when you search some country you want to visit, you get both internet pages and Dokuwiki notes about a planned holiday there.

Building

Anyway - I thought it would be useful, and I was pretty sure it was possible, probably even easy for someone who knows what they are doing. However, I am not such a person. Luckily, most of the work has already been done: the Linkding injector plugin is open source, so I can just copy most of it, and I 'only' need to add a connection to Dokuwiki. Of course, this is still pretty challenging if you don't know much about browser extensions, javascript, or web development1).

With a bit of experimentation, some trial and error, and some AI-generated suggestions2), I got there. I leave the Linkding Injector plugin untouched as much as possible; the the placement of the Linkding/Dokuwiki results, all the styling of text, etc. are all directly copied over. The only thing I do is passing on Dikuwiki results instead of Linkding results. The connection to Dokuwiki is relatively straightforward using Dokuwiki's built-in JSON-RPC API 3). Every time you search something on the web, we also search Dokuwiki using its built in searching function. If anything is found, we show the page title as a link in its own little box, and if not, we show nothing at all. Straightforward, useful, nice, I love it.

Relying on the upstream Linkding injector extension has its advantages and disadvantages. An obvious advantage is that all the difficult work has basically been done for me - no figuring out how to use CSS or svelte4). On top of that, I can also make use of updates in that project. When Google or Bing changes the way their page looks, the Linkding injector extension will (hopefully) be updated5), and I can simply copy the update to also update my Dokuwiki injector extension with minimal changes. The disadvantage is that my little pet-extension relies almost completely on the volunteering work of the upstream Linkding injector extension. The moment when that stops being maintained, this browser extension will also stop working - unless I learn to use CSS properly in a very short time-span. All-in-all a very effective example why Open Source software is nice!

Using

I've been using the extension for 2 weeks now, and I thought it was pretty useful, so what the hell, I will just publish it on the Firefox add-on store and the Chrome extension store6). Maybe it is useful for someone else.

The extension is by no means perfect, there are a few things that would be nice to have. An obvious improvement would be to show the first few lines of text of a Dokuwiki page in the search box (much like a search engine does), but honestly I felt like I already spend too much free time on this random little project - so maybe someday, but not now. If you have any other ideas or improvement, of course feel free to reach out or contribute to the project via Github!

At any rate, I hope you find the browser extension useful - and even if not, maybe it convinces you that you can write very simple web extensions like this, even if you don't really know what you are doing… This project has been a small, interesting dive into browser extensions and I gained some knowledge I will probably never use again - but it was kinda fun, and something useful came out, so who cares!

You can find the source code here 7), or simply install the extension for Firefox or Chrome-based browsers.

1)
like me
2)
I am not confident it helped more than it worked against me to be honest, but I guess this is just the trying-something-new-in-2025-experience.
4)
or, in fact, how to spell Svelte
5)
many, many thanks in advance if the extension maintainer is reading this!
6)
it costs me $5.00 to get a Google developer account to distribute a free extension 😔. Oh well.
7)
you can see me creating problems and solving them in the commit history, if you are into that sort of thing - don't judge me too harshly please.

Comments

Enter your comment: