I've been using a RamNode VPS for over 3 years now. It's extremely low-end, having only 128MB of RAM, so something as lightweight and fast as Nginx was perfect to host my static website.
At the time I was new to provisioning a web server from scratch and ended up doing a lot of things just to get to a working state. Over time it's evolved as I learnt new tricks, leaving a mess in the process.
This seems to be a problem with any project in both the cyber and physical world. As you create more of something, you need to decide where to put them and reorganise everything else. Making it refactoring essentially.
Anyway, for this article I'm strictly talking about directory structures and where to put files used by a web server. No matter which web server you're using, the solution probably applies equally.
My website is made up of static pages, there is no central database. How do I implement search functionality so users can find the content they're looking for?
One of the biggest downsides when building static websites is the inability to query your data. Sure you can tag and categorise pages and create yet another page that lists them, but that alone is extremely limiting for the user. If you want to give users the ability to search through your website using plain text or any combination of tags, you can't do so on a static website. Well, you can, by creating endless permutations of every possible user input but let's not get into that.
So, what's the solution? There's a few. None of them are perfect.
My blog can cover a wide range of topics which I organise using tags. How can I provide filtered RSS/Atom feeds so that my readers can subscribe to the tags that interests them?
I recently needed to provide tag filtered feeds for the Unruly Tech site which uses it to aggregate relevant posts from my blog with other blog-enabled developers at Unruly. Previously Tumblr provided this functionality but it was lost when I migrated to Middleman and static hosting.
It's pretty straight forward to do once you get your head around some of the template trickery that Middleman allows and boils down to two steps.
I have a Middleman project and I want to push to GitHub Pages. How can I ease the process of making changes to the project's source files and publishing its generated static files?
Recently, I've been using Middleman to build static websites. I've dwelled into static site generators in the past but never really got into it until I started to build an actual website, the Unruly Tech site, which has multiple, often similar but slightly different pages. Copying and pasting became a chore and I didn't want to run a full blown server to compile templates due to the extra management. Hosting on GitHub Pages was enough.
Previously, working with GH Pages was simple enough. Just make changes to static assets and push them to gh-pages. But now with Middleman being the middleman, I had to make changes, compile the static files locally and then push those to gh-pages. What a chore.
Of course you could write a script to do it all in one command, but that also meant other contributors had to do the same and have a compatible environment with dependencies. That's way too much setup for a simple setup.
Now comes Travis CI. Travis is an automated build server, free for open source projects. It hooks into a repo and automatically runs scripts in a defined environment when something's pushed. With this, I now had a common environment to deploy from with minimal faff.