Small Nginx Module
So I've added in a search bar to the site.
This is a bit more involved than it sounds. One of the things that I really want to keep this site, is static, without any javascript. Or rather, static as much as possible, self-contained with a really simple, cheap, and cost-effective webserver (nginx) serving up the content.
The issue with this is, you can't really do anything dynamic (based on something the user types in, for example), you're limited purely to static stuff, unless you want to write some C and write an nginx module.
So I did. And here's the github repo which hosts the code I'm using to run the search: https://github.com/adamharrison/nginx-xapian.
I know, I know, it's currently riddled with bugs, and is frankly, unsafe. I shouldn't be using it on this live site. It's relatively safe because this machine doesn't really contain anything of value, and is just a VM in Amazon's cloud, which I can simply kill at any time, without losing anything, but still.
That's what I've been working on for the past week or two in my spare time, an hour here, an hour there, in between writing. In the end, I'm actually pretty pleased with it; it's pretty quick, and while it could be a lot more efficient, and there's a lot of work to do in terms of making it update its indices dynamcially based on files updating, and whatnot, but it seems to get the job mostly done.
So, search is up, with no javascript, and no script-based back-end. Good stuff.
So I've added in a search bar to the site.
This is a bit more involved than it sounds. One of the things that I really want to keep this site, is static, without any javascript. Or rather, static as much as possible, self-contained with a really simple, cheap, and cost-effective webserver (nginx) serving up the content.
The issue with this is, you can't really do anything dynamic (based on something the user types in, for example), you're limited purely to static stuff, unless you want to write some C and write an nginx module.
So I did. And here's the github repo which hosts the code I'm using to run the search: https://github.com/adamharrison/nginx-xapian.
I know, I know, it's currently riddled with bugs, and is frankly, unsafe. I shouldn't be using it on this live site. It's relatively safe because this machine doesn't really contain anything of value, and is just a VM in Amazon's cloud, which I can simply kill at any time, without losing anything, but still.
That's what I've been working on for the past week or two in my spare time, an hour here, an hour there, in between writing. In the end, I'm actually pretty pleased with it; it's pretty quick, and while it could be a lot more efficient, and there's a lot of work to do in terms of making it update its indices dynamcially based on files updating, and whatnot, but it seems to get the job mostly done.
So, search is up, with no javascript, and no script-based back-end. Good stuff.