Website Builder - The Beginning
Some time ago i started thinking of building a better tools page for Imago. One of my requirements was that it had to be a plain static xhtml site, no dynamic generation on request. It's the most frequented page here, so i'd prefer a simple static site. But i didn't like to hardcode layout and content in one file. That would be a maintenance nightmare for me. I needed a better solution and came up with the following must have requiremtents:
- Separation of layout/design (xhtml) and my text content
- Easy use of free/open source templates
- Content my be written in markdown or similiar syntax
- Splitting page content into multiple files
After some time googling i gave up. I didn't find an existing app, neither one i could easily adjust. So the Codeboje Website Builder (bloody working name) was born.
What does it do?
Our Website Builder is a simple tool that lets you build your website from simple templates and keep the contents in markdown text.
How it differes from other solutions:
- no configuration file, we use a simple naming scheme
- each page can have it's own template
- we are using the django template system, so no new template engine and and selfmade syntax to learn
- the content of a single html page can be split up into multiple textblock and every block has its own text file
Website Builder depends on the following python modules:
- django template engine
- python markdown
- codehilite for python markdown
- one syntax hightlighter supported by codehilite
How to use it?
It's simple and has some minor prerequisite one should know. Best is we take a look at the folder structure.
As you can see in the screenshot we need a folder for the content and one for the templates. The content files must have the endind .md.
The content folder:
Each page to generate has to have its own subfolder here. The name of the folder is also the name of the resulting page. All .md files inside a subfolder will be markdowned and accesible in the django template context. A simple named scheme applies:
- If the .md file is named the same as the folder it's handled as the maincontent (main_content) for this page.
- all others get a section_ prefix and - are replaced by _
In addition there are 2 special folders:
- the static folder contain static file which get copied to the generated output directory. For images, some css and alike
- a commons folder for content block which should be available in more then one page
Each page can have its own template (pagename = templatename). Theres a fallback to the default.html template if none for the site is found. You should have full django template support.
After merging you'll find the generated site in ./generated_html/ .
download the sitebuilder here Feedback is welcome :-)
comments powered by Disqus