Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Static website generator inspired by Jekyll
Python JavaScript
tag: 0.1a

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
hydeengine
lib
templates
tests
.gitignore
LICENSE
README.markdown
hyde.py

README.markdown

HYDE

0.1 Alpha

Hyde is a static website generator with the power of Django templates behind it. You can read more about its conception, history and features here and here.

Basic Installation

The very basic installation of hyde only needs Django. More python goodies are needed based on the features you may use.

sudo easy_install django

Get the hyde source by git cloning this repository.

Running with Hyde

The hyde engine has two entry points:

  1. Initialization

    python hyde.py -i -s path/to/your/site [-t template_name = default] [-f]
    

    During initialization hyde creates a basic website by copying the specified template (or default). This template contains the skeleton site layout, some content pages and settings.py.

    Be careful with the -f setting, though: it will overwrite your website.

  2. Generation

    python hyde.py -g -s path/to/your/site [-d deploy_dir=path/to/your/site/deploy]
    

    This will process the content and media and copy the generated website to your deploy directory.

Site structure

  • layout - Template files that are used as base templates for content. None of the files in the layout folder are copied over to the deploy directory.
  • content - Any file that is not prefixed with _, . or suffixed with ~ are processed by running through the template engine.
  • media - Contains site media, css, js and images.
  • settings.py - Django and hyde settings.

Recommended conventions

These conventions will make it easier to configure hyde plugins.

  • Prefix files in layout and other template files in content with underscores
  • Keep media folder organized by file type[css, flash, js, images].

Configuring your website

Most of the boilerplate configuration comes as a part of the initialized website. The only setting you have to override is the SITE_NAME setting.

Media Processors

Media processors are defined in the following format:

{<folder>:{
    <file_extension_with_dot>:(<processor_module_name1>, <processor_module_name2>)}
}

The processors are executed in the order in which they are defined. The output from the first processor becomes the input of the next.

A * instead of folder will apply the setting to all folders. There is no wildcard support for folder name yet, * is just a catch all special case.

File extensions should be specified as .css, .js, .png etc. Again no wildcard support yet.

Hyde retains the YUI Compressor, Clever CSS and HSS processors from aym-cms.

Template Processor

Template processor allows the use of context variables inside your media files.

YUI Compressor

Runs through the all the files defined in the configuration associated with 'hydeengine.media_processors.YUICompressor' and compresses them.

In the settings file, set YUI_COMPRESSOR to be a path to a YUI Compressor jar on your computer.

Clever CSS Processor

Runs through the all the files defined in the configuration associated with 'hydeengine.media_processors.CleverCSS' and converts them to css.

You need to install Clever CSS using sudo easy_install CleverCSS command for this processor to work.

HSS Processor

Runs through the all the files defined in the configuration associated with 'hydeengine.media_processors.HSS' and converts them to css.

You need to download HSS from the project website and set the HSS_PATH variable to the downloaded path. A version for OS X is installed in the lib folder by default. To use it, just uncomment the HSS_PATH line in the settings.py file of your template.

Content Processors

Content processors are run against all files in the content folder where as the media processors are run against the media folder.

These processors allow content pages to define their own context variables that are passed to the entire template hierarchy when the page is processed. This is accomplished by using a special tag at the top of the content page(after any extends tags you may have).

{%hyde
    <Your variables>
%}

Every page in the template hierarchy gets these context variables: site and page. The site variable contains information about the entire site. The page variable represents the current content page that is being processed. The variables defined at the top of the content pages using the {% hyde %} tags are available through the page variable as attributes.

YAMLContentProcessor

'hydeengine.content_processors.YAMLContentProcessor'

Requires pyYAML. You can install pyYAML with sudo easy_install pyYAML command. On your content pages you can define the page variables using the standard YAML format.

{%hyde
    title: A New Post
    list: 
        - One
        - Two
        - Three
%}

PyContentProcessor

'hydeengine.content_processors.PyContentProcessor'

Requires py.code. You can install py.code with sudo easy_install py command. The variables are defined using the python dictionary syntax. The same example from above:

{%hyde
{
    "title": "A New Post"
    "list": ["One", "Two", "Three"]
}   
%}

Update: This processor is no longer supported. The code is still around, since I exclusively use the YAMLContentProcessor for Ringce, I have not been able to ensure if this works as expected. Moreover, the YAML context has been much easier to work with.

Template Tags

Hyde retains the markdown and syntax template tags from aym_cms. Additionally hyde introduces a few tags for excerpts. These tags are added to the Django built in tags so there is no need for the load statements.

AYM Template Tags

For these tags to work markdown and pygments have to be installed.

sudo easy_install markdown
sudo easy_install Pygments

Markdown

markdown renders the enclosed text as Markdown markup. It is used as follows:

<del>{% load aym %}</del>
<p> I love templates. </p>
{% markdown %}
Render this **content all in Markdown**.

>> Writing in Markdown is quicker than
>> writing in HTML.

1.  Or at least that is my opinion.
2.  What about you?
{% endmarkdown %}

Syntax

syntax uses Pygments to render the enclosed text with a code syntax highlighter. Usage is:

<del>{% load aym %}</del>
<p> blah blah blah </p>
{% syntax objc %}
[obj addObject:[NSNumber numberWithInt:53]];
return [obj autorelease];
{% endsyntax %}

They are both intended to make writing static content quicker and less painful.

Hyde Template Tags

The {%hyde%} tag is used for the page variables, as a template tag all it does is swallow the contents and prevent them from showing up in the html. The even safer approach is to define this tag outside of all blocks so that it is automatically ignored.

Excerpt

The {%excerpt%}{%endexcerpt%} tag decorates the output with html comments that mark the excerpt area. Excerpts marked in this manner can be referenced in other pages using the {%render_excerpt%} or the {%latest_excerpt%} tag.

Render Excerpt

Render Excerpt takes a page variable and optional number of words argument to render the excerpt from the target page.

Latest Excerpt

Latest Excerpt takes a content folder path and optional number of words as input. It parses through the content pages looking for page variables named created and gets the page with the maximum value and renders the excerpt from that page.

Typogrify

To enable Typogrify, use {% filter typogrify %} in your code. Typogrify is "a collection of Django template filters that help prettify your web typography by preventing ugly quotes and widows", according to the project web site. It is automatically enabled in the default template.

Base Templates

The default site layout contains templates for basic site structure, navigation, breadcrumbs, listing and posts. However, no CSS is included yet.

Examples

The Ringce website source is available as a reference implementation.

CONTRIBUTORS

Something went wrong with that request. Please try again.