Getting Started

Installing Blended

To use Blended You need to install it first. Make sure you have either Python 2 or Python 3 installed and also make sure that you are able to install packages using PIP.

To install Blended run

pip install blended

or, if you need administrator permissions to install, run

sudo pip install blended

This will give some output and and soon as you see Installed package: blended you are good to go!

Initializing Your First Website

To start your first website with Blended, create a new folder to hold the files and then enter it.

mkdir newWebsite

cd newWebsite

After that, have Blended initalize the folder by running

blended init

you should get a number of prompts asking for some information about your new website.

If everything worked correctly, you should see The required files for your website have been generated but if not, make sure that your user permissions are correct.

Website File Structure

When you look inside your website's folder, you will see that Blended has created a couple of files and folders.

The content folder is where you will put your page content. Content can be written in HTML (.html), Markdown (.md), Textile (.tile), reStructuredText (.rst), Microsoft Word (.docx), Jade (.jade), and Plain Text (.txt).

The templates folder is where you will put all of your template files. Page templates are written in HTML.

Inside the templates folder there is an assets folder wich holds the styles, scripts, and images for your website.

Styles can be written in CSS (.css), Sass (.sass/.scss), Less (.less), and Stylus (.styl).

Scripts can be written in JavaScript (.js) or CoffeeScript (.coffee).

The great thing about Blended is that it allows you to use all those file formats at once to write your website and they will all be compiled to human-readable HTML, CSS, and JavaScript.

Whenever you write a page, you create a new file in one of the available file formats and place it inside of the content folder.

Working with templates

You can install templates from GitHub using blended install-template.

Each Blended website uses four template files:

In these files you place the markup for each section to be generated.

When working with pages, you can optionally specify which template you want (other than content_page.html) by adding the name of the template file without the extension to the first line of the page, and then at least five +s to the second line. For example, if I wanted to use a template called blog_page.html for a certain page, I would put

blog_page

+++++

at the top of the page. Make sure you put it at the top or else it will not work!

You have some variables that you can use in your templates to pull in values while building:

Wherever you put these variables in the templates, they will be replaced by the values in your config.py file. The variables must stay within the curley brackets. You can even put variables inside the content of other variables!

Working With Plugins

You can install plugins from PyPi, for example pip install blended_google_analytics. You can also install plugins from GitHub using blended install-plugin.

To use plugins, include them in the plugins list in config.py.

If the plugin is meant to be called in your templates, ex. html_comment_box then insert it into the plugins list like plugins = ["html_comment_box"].

You can use multiple plugins at once, ex. plugins = ["html_comment_box", "minify_images"]

Working With Custom Variables

Inside of your config.py there is a variable custom_variables = {}. This is a dictionary of all of the custom variables you would like to use. To add a variable, add it as a dictionary item.

Here are some examples:

custom_variables = {"software_name": "Blended"}

custom_variables = {"software_name": "Blended", "software_version": "5.0"}

Importing from WordPress

You can import a website and posts from WordPress. To do so, export from WordPress using the Posts option and download the file to the directory where you want to generate your website.

Run the command blended import-wp and it will prompt you for the name/file path of the file. Type in the filename and Blended will create a new website with the information.

Importing from Blogger

You can import posts from Blogger. To do so, export from Blogger using the Backup Site option and download the file to the directory where you want to generate your website.

Run the command blended import-blogger and it will prompt you for the name/file path of the file. Type in the filename and Blended will create a new website with the information.

Building and Sending

To build the files that you have written, run the command

blended build

If it gets too cumbersome to be running blended build every time you make a change, run

blended interactive

and it will automatically rebuild the files each time that you make a change.

Once you have built the files, you can enter your web server login information into config.py and then run

blended ftp

and all the files will be automatically uploaded for you.

Also, you can run

blended zip

and Blended will make a zipfile out of your build folder so that the files inside can be easily distributed.