My first Experience with DocPad and Node.js
I was looking for ways to speed up my website, and short of upgrading the package with my hosting company it was going to be tough. My site was running on the back of Wordpress for quite some time and it was great. Wordpress gained momentous traction within the internet communities as a quick way to get a blog up and running.
The problem for me is that the PHP sessions that are created can tax the server of my shared hosting, and occasionally additional requests can peak the memory allowance. This results in the occasional HTTP 503 - not good. When the server is running smoothly the amount of time to render a Wordpress page (with plugins) can already take some time. Google Analytics gives an average page load time 5.62s.
I have tried to alleviate this in the past by using a Wordpress cache tool called W3 Total Cache - which works. However during cache creation it also causes the occasional HTTP 503.
Maybe I don’t need all of the features of Wordpress. I don’t need the web server to do anything more than serve the pages that I create. So why not generate the page once and be done with it. Well there will be issues with navigation and sitemaps if those pages aren’t updated overtime a new page is added. Naturally I don’t want to hand author every page that has altered either, so I set about looking for a static site framework, or generation tool.
I’m a programmer at heart, so I am quite capable of putting a little bit of extra work - maybe I could set up a local PHP / MySQL server and use Wordpress as a generation tool, and then upload the generated pages - that could be difficult to maintain, with some pages not required in a static environment.
What do I need?
DocPad is very lightweight to start with. Basic setup allows for basic server setup and file watching, but it is ready for Plugins/Modules galore. There are some skeletons available to get started, but I like reinventing the wheel so I start with a blank slate - and go browsing the plugin list.
- docpad-plugin-eco - basic template engine, pretty much required to create some logic within pages, easy to use.
- docpad-plugin-partials - useful way to include snippets from additional files.
- docpad-plugin-marked - Markdown parsing, should make writing articles quickly.
- docpad-plugin-stylus - Stylus support, to make CSS authoring easier
- docpad-plugin-highlightjs - Used with Markdown support to Highlight code within my articles.
- docpad-plugin-livereload - Development tool for the local server, using WebSockets to reload the page while editing for instant preview.
- docpad-plugin-cleanurls - Creates URLs like /article/article-name/(index.html) from article-name.html.
I recommend getting involved, download Node.js, and Install DocPad give it a try.
It did not take too much time to reconstruct my website from the ground up, and DocPad and Plugins were very accomodating. Only time will determine if it was a good idea to make the change - but for now I am happy with what I have done.