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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

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

Listing 5 illustrates the use of Markdown to express part of a page's content,<br />

using the {% filter markdown -%} instruction to invoke <strong>Hyde</strong>'s built-in markdown<br />

converter.<br />

Listing 5. Example page based on Listing 3, but overriding two Jinja template<br />

blocks, using Markdown<br />

--- extends: minimalism.j2 title: Strange Case of Dr Jekyll <strong>and</strong> Mr <strong>Hyde</strong><br />

description: Tribute to a Victorian classic ---<br />

{% block intro %}<br />

<br />

<br />

{% filter markdown -%}<br />

# *Strange Case of Dr Jekyll <strong>and</strong> Mr <strong>Hyde</strong>*<br />

## "I knew myself, at the first breath of this new life, to be more wicked..."<br />

{%- endfilter %}<br />

<br />

<br />

{% endblock intro %}<br />

{% block group1 %}<br />

<br />

{% filter markdown -%}<br />

### The author<br />

**Robert Louis Balfour Stevenson** (13 November 1850 – 3 December 1894) was a<br />

Scottish novelist, poet, essayist <strong>and</strong> travel writer. His best-known books include<br />

*Treasure Isl<strong>and</strong>*, *Kidnapped*, <strong>and</strong> *Strange Case of Dr Jekyll <strong>and</strong> Mr <strong>Hyde</strong>*<br />

{%- endfilter %}<br />

<br />

<br />

<br />

Read more<br />

<br />

{% endblock group1 %}<br />

Only the content <strong>with</strong>in the filter instructions are interpreted as markdown. Notice how<br />

those bits are flush left, unlike the HTML bits, which are indented according to block<br />

elements. This is because indentation is significant in Markdown <strong>and</strong> not in HTML.<br />

Summary<br />

I only scratched the surface of the features available in Jinja templates <strong>and</strong> other<br />

components of <strong>Hyde</strong>. That works fine because <strong>Hyde</strong> is designed so that you can<br />

begin <strong>with</strong> the simpler functions <strong>and</strong> work up to more sophisticated features as<br />

you go along, whenever you need to enhance automation <strong>and</strong> workflow. You can<br />

develop many simple web pages <strong>with</strong> simple blocks (which you can nest). If you need<br />

automatically compiled weblogs <strong>and</strong> the like, <strong>Hyde</strong>'s default layout provides a good<br />

example.<br />

Overall, <strong>Hyde</strong> gives you most of the features of content management systems <strong>and</strong><br />

low-level web publishing frameworks. With the file system as the backing store, very<br />

little of your system is obscured or mysterious. I think this is a great benefit, <strong>and</strong> you<br />

now have enough of the basics to get started <strong>and</strong> create a simple web page <strong>with</strong><br />

<strong>Hyde</strong>, <strong>and</strong> a web design template of your choosing.<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 7 of 9

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

Saved successfully!

Ooh no, something went wrong!