Static blog generator
Our objectives about blogging are
- text editor over editing text in browser
- simple templating engine over WYSIWYG editors
- dedicated source control system over primitive publishing mechanisms
- static site hosting over dynamic hosting where it is possible
To serve it we provide simple Python script that will generates content from markdown templates.
To start use it you need to perform just few steps
-
Download blogator script
-
Install dependencies with
pip3 install markdown
andpip3 install pystache
commands -
Create file BLOG_FILE that will describe your blog. It could be as simple as
title: Blogging annotation: keep calm and blog on posts: intro.md history.md
-
Create files with posts for
intro.md
,history.md
. The could be as simple astitle: About blog My blog entry
-
Generate content:
python3 blogator.py BLOG_FILE -target OUTPUT_DIR
. -
Done! Generated content is now in OUTPUT_DIR.
You can specify next basic options in your BLOG_FILE
- title: title of your blog that could be shown on blog pages.
- annotation: short description that could be show on your pages.
- favicon-file: file from your local file system that could be used as a favicon.
Could not be used together with
favicon
attribute. - favicon-url: url to the image that could be used as favicon.
Could not be used together with
favicon-file
attribute. - posts: lists of files where posts stored
See blog file sample
You can specify next basic options in your BLOG_FILE
- title: title of the post that could be displayed on the page, used to create links, etc.
- brief: brief content that would be displayed on index page. If no brief present whole post will be shown.
- short_title: shorten title that could be used to crete links, etc.
- link_base: link to the post.
- published: date of publishing that could be displayed on pages, used for sorting, etc. Use
%Y-%m-%d
format to specify it, like2011-10-26
.
We support trafic's statistic throw integration with Google Analytics. To add it to your blog
- Sign up to the Google Analytics.
- Get your Tracking ID.
- Use this id as value for
ganalitics
in blog meta.
We support post comments throw integration with Disqus. To add comments to your blog
- Sign up to the Disqus
- Go to
Add Disqus to Your Site
page and fill form on that page - Finish form on that page
- Choose
Universal code
- Find your discus code at line
var disqus_shortname = 'YOUR_CODE';
- Use this code for setting
disqus
value in blog meta.
One of hosting options could be GitHub pages. It's free and supports domains in format YOUR_ID.github.io
or your custom domain. To host there
- [Create Github account] github-new
- Create repository YOUR_ACCOUNT_NAME.github.io
- Push generated content to master branch of your repo
For details please wisit GitHub pages
You can use any workflow to work with blogator. Here is one based on git branches
Prerequirements:
- python 3.2.+ installed
- dependencies (markdown, pystache) installed
- git installed
- github account created
-
Create new repositiry on github
-
Create new directory for your blog
mkdir test-blog
-
Change your directory to newly created
cd test-blog
-
Download blogator script
curl https://raw.githubusercontent.com/st-kurilin/blogator/master/blogator.py > blogator.py
-
Create place to store your blog's raw content. src directory will be created. raw branch will be used.
git clone -b src --single-branch YOUR_GITHUB_REPO raw
-
Create place to store your blog's generated content. site directory will be created. master branch will be used.
git clone -b master --single-branch YOUR_GITHUB_REPO site
-
Create all needed files in src directory. Including filling you blog meta file and posts. You can make commits and pushes when you need them.
echo "title: Hello world" > src/blog
-
Run blogator script to generate content
python3 src/blog -target site
-
Commit and push your site directory content.
We use Python 3.4.1
for development. We do not test it on other Python versions. I assume that it should work fine for Python >= 3.2. Dependencies could be installed with pip3 install -r requirements.txt
.
Preretirements are:
- Installed git and created github account
- Installed Python 3.4.+, pip3, pylint
To make you changes please follow next steps
- Fork https://github.com/st-kurilin/blogator
- Run
pip3 install -r requirements.txt
to install all dependencies - Make your changes. We use
blogator_src
as a main script. To build a distributable script runbuild.py
. - Make sure you pass tests from
blogator_test.py
. You can add more there as well. - Run pylint and make sure you leave the project better than you found it
- Create a pull request