Perl programmer for hire: download my resume (PDF).
John Bokma's Hacking & Hiking

Testing tumblelog

This article assumes you have cloned tumblelog using git, installed its prerequisites, and the current working directory is tumblelog as described in Installation of the Python version or Installation of the Perl version.

In order to test tumblelog, first create a directory inside the tumblelog directory to store the output the program generates, for example named htdocs:

mkdir htdocs

Next, create a stylesheet for the test blog. The program comes with several predefined styles; sources for such stylesheet. You can see which are available with:

ls -1 styles

Note that _tumblelog.scss is a file that's included by all other style files and not a style in itself. The screenshots directory has a screenshot per available style.

The styles are in a special format and have to be converted using the sass program. For example to convert the style steel.scss to CSS use:

sass --sourcemap=none -t compressed styles/steel.scss htdocs/steel.css

This creates a compressed stylesheet inside the htdocs directory.

Next you can generate the tumbelog pages and two feeds as follows:

python3 tumblelog.py --template-filename tumblelog.html --output-dir htdocs/ \
        --author 'Test' --name 'Test Blog' --description 'This is a test'    \
        --blog-url 'http://example.com/' --css steel.css tumblelog.md

Note that in the above a backslash means "continue on the next line", and no character should follow it, so make sure to press return after each \ character.

The arguments to tumbelog.py are as follows:

If you prefer to use the Perl version, the following gives the same result as the above Python version:

perl tumblelog.pl --template-filename tumblelog.html --output-dir htdocs/ \
     --author 'Test' --name 'Test Blog' --description 'This is a test'    \
     --blog-url 'http://example.com/' --css steel.css tumblelog.md

The arguments are the same as for the Python version.

The files generated by this command are all written to the htdocs directory or subdirectories thereof. If you use the example Markdown file tumblelog.md the directory layout will be as follows:

Contents of the htdocs directory
Contents of the htdocs directory.
htdocs/
|-- about.html
|-- archive
|   `-- 2019
|       |-- 10
|       |   |-- 05.html
|       |   `-- 06.html
|       `-- week
|           `-- 40.html
|-- feed.json
|-- feed.rss
|-- index.html
|-- steel.css
`-- subscribe.html

The files contain the following information:

If you have Python 3 installed you can view the generated blog site inside a web browser as follows:

cd htdocs
python3 -m http.server

Go to http://localhost:8000/ to view the index page of the blog.

And if you have Python 2 installed you can serve the web pages using:

cd htdocs
python -m SimpleHTTPServer 8000

And view the generated blog using the same address as given above.

Finally, I generate my own blog, Plurrrr, using the following arguments:

perl tumblelog.pl --output-dir htdocs        \
    --template plurrrr.html --css soothe.css \
    --author 'John Bokma'                    \
    --description "John Bokma's tumblelog"   \
    --blog-url http://plurrrr.com/           \
    --name 'Plurrrr' --quiet plurrrr.md

Continue reading in Getting started with tumblelog.

Related