23.03.2013 Views

Build rapid and lightweight static websites with Hyde - IBM

Build rapid and lightweight static websites with Hyde - IBM

Build rapid and lightweight static websites with Hyde - IBM

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

developerWorks® ibm.com/developerWorks/<br />

horsepower. Another issue is backups <strong>and</strong> content portability. When you choose a<br />

CMS or web publishing framework, you rely on it to make sense of your content. With<br />

your content tied up in database tables, you can't easily reach in <strong>and</strong> grab a file to<br />

share. The move to a different infrastructure can be a daunting task. You also have to<br />

rely on specialized tools for backup <strong>and</strong> restore.<br />

The characteristic underlying these issues is transparency. Web publishing<br />

frameworks <strong>and</strong> CMSs are generally not transparent, which means a lot of special<br />

knowledge is required to underst<strong>and</strong> how they store, manage, <strong>and</strong> serve up content.<br />

To some extent, this requirement is inevitable on all but the simplest <strong>websites</strong>, but<br />

recently emerging projects offer some frameworks benefits, <strong>with</strong>out losing the core<br />

element of processing <strong>and</strong> publishing simple files on a server. One popular such<br />

framework is Jekyll. Some developers built on the core ideas of Jekyll, but using a<br />

different set of building blocks created the open-source <strong>Hyde</strong> project. <strong>Hyde</strong> is now my<br />

web publishing system of choice. It is simple yet offers a great deal of power, <strong>and</strong> it<br />

limits most of its business to processing simple files to generate a <strong>static</strong> site, resulting<br />

in a great deal of efficiency <strong>and</strong> flexibility.<br />

Getting started <strong>with</strong> <strong>Hyde</strong><br />

<strong>Hyde</strong> is a system written in Python that allows you to manage content <strong>and</strong> templates<br />

in a directory on the file system of your web development machine. You create or<br />

update the content using a regular text editor <strong>and</strong> comm<strong>and</strong>-line tools, or you can<br />

use an IDE if you like. When you're ready to see how it looks, <strong>Hyde</strong> can generate the<br />

site <strong>and</strong> serve it up locally using a test web server. When you are satisfied <strong>with</strong> how<br />

the site looks in test mode, you can push the <strong>static</strong>, generated files to your production<br />

web server for Apache, Lighttpd, Nginx, or any web server that can serve files at<br />

lightning speeds.<br />

Installation <strong>and</strong> setup<br />

If you do web development on Mac or Linux systems, you already have the main<br />

thing you need, Python. Python is also easy to install on Microsoft® Windows®<br />

<strong>and</strong> most other platforms. To install <strong>Hyde</strong> in your Python library, invoke sudo<br />

easy_install hyde or pip install hyde, depending on your setup. When you do<br />

so, the hyde comm<strong>and</strong> should be available. To start, set up <strong>Hyde</strong> in a directory <strong>with</strong> a<br />

skeleton set of files for a typical website <strong>with</strong> this comm<strong>and</strong>:<br />

hyde -s $PATH_TO_DIRECTORY create<br />

Replace $PATH_TO_DIRECTORY <strong>with</strong> the directory where you want to work on content<br />

<strong>and</strong> template files.<br />

The above comm<strong>and</strong> uses a default layout for a site, but <strong>Hyde</strong> allows you to pick<br />

other site layouts. This option is useful if you want to use some well-known toolkit or<br />

setup for your site, for example, if you use the Twitter Bootstrap framework, or if you<br />

know the target site will be a weblog.<br />

<strong>Build</strong> <strong>rapid</strong> <strong>and</strong> <strong>lightweight</strong> <strong>static</strong> <strong>websites</strong> <strong>with</strong> <strong>Hyde</strong> Page 2 of 9

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!