A will for creating a personal portfolio cum blog site, after spending a lot of time researching and experimenting with various frameworks, came to an end with this. I’m glad to discuss my experience with a new open-source technology, smelting this site, HYDE. HYDE’s built-in web server + auto-generator provide instant refresh and unlimited flexibility. No database, no slowness, no digg-effect.
It saves a lot of considerable amount of time rather writing from the scratch. It’s built-in features and plug-ins inspired me to work with it. After satisfying the requirements for the HYDE environment to be set up, it’s hardly a matter of few seconds to have a full-structured working site on your local web server. You’ll greatly appreciate the amount of time spent in serving up when you’ll read about integrating your work with Fabric below, that even these few seconds can be reduced to merely a second, Yep! just a single command to have your website cum blog serving up. Isn’t it interesting? Yeah, Carry on!
using python-pip for installing
Creating a new hyde website (default layout for site)
After editing and modifying the layout, site is generated
Serve the site Finally start the built in web server that also regenerates based on the request if there are changes.
Publish the site Publishes the site based on configuration. Currently the only supported publishing target is a git repository.
The above steps i.e removing deploy dir, generating and serving can be combined under one hood, using python awesome library fabric. It’s a command-line tool and it provides a basic suite of operations for executing local or remote shell commands (normally or via sudo) and uploading/downloading files.
Not many people enjoy executing a series of line-by-line commands, which they require frequently. Fabric is thus, very useful when you have to execute a series of commands, without waiting to run next upon completion of former.
YAML: YAML Ain’t Markup Language
What It Is: YAML is a human friendly data serialization standard for all programming languages. It is used for configuration files. HYDE provides control of how templates are applied, using YAML for configuration settings.
site.yaml indicates how some local file directories are translated to paths for the web server, specifies plug-ins to be used like ‘meta.TaggerPlugin‘, ‘text.SyntextPlugin‘, etc. and provides basic metadata.
HYDE builds in a processor that allows you to author web pages in Markdown rather than HTML. Markdown is a lightweight markup language, which helps in avoiding hand-authoring HTML, and edit just plain text using special characters to indicate the various HTML markup constructs, and finally converts that plain text formatting to HTML.
Since this was my first experience creating website, i found Markdown simply awsesome to learn and use. It reduces my lots of HTML-coding efforts and helps me writing my blog-posts similar to the way i usually wrote an essay in school :)
I won’t be undertaking an introduction to Markdown, but can provide a simple example to grab on it.
will be converted to :
You can try it out online Dingus
Ah, HYDE’s built-in plugin Pygments and syntax tag for Syntax Highlighting is just beautiful. It not only makes the code readable but also push colourful pixels to your site. Put the following code along with your Markdown code (as discussed above) to enjoy the Syntax Highlighting for several programming languages.
Replace ‘lang_name’ in the code below with the programming language in order to highlight its syntax. For eg- css, HTML, python, etc. Here lang_name corresponds to python.
A template is simply a text file. It can generate any text-based format (HTML, XML, CSV, etc.).
A template contains variables, which get replaced with values when the template is evaluated, and tags, which control the logic of the template.
Jinja2 is a modern and designer friendly templating language for Python, modelled after Django’s templates. It is fast, widely used and secure with the optional sandboxed template execution environment.
The templates go in the layout directory, and you add and update templates there to manipulate the overall content outline of your site.
Below is a minimal template that illustrates a few basics.
Full documentation can be found on Jinja2 Docs
I found this template engine quite interesting to use. A template allows to express most of the replicated entries in each HTML page only once, which is often called as base template of the whole site, and is automatically applied to all the pages which inherit them, often called as child template.
This is the directory where static files such as images, stylsheets and script-files are stored in order to serve the site. This folder is the foundation for providing the structure to the site. HTML page files starts with the page metadata and then inherit the code (as stored in jinja files with .j2 ext ) from the layout directory.