Code for the Nikola-based Weka blog.
The blog itself is located here:
See the Get started page on the Nikola homepage.
Configuration file for the site is conf.py
.
To build the site:
nikola build
To see it:
nikola serve -b
To check all available commands:
nikola help
-
requires
ghp-import
package -
command for deploying
nikola github_deploy
CentOS does not have Python 3.5 packages directly available through packages,
but rather through software collections (scl
).
Python 3.5 is enabled like this (from an interactive shell):
/bin/scl enable rh-python35 bash
Assuming that the weka-blog repo is installed in /var/lib/jenkins/repos/weka-blog
,
you can use the Execute shell build step with this script to automatic deploy
the github pages if the repo has changed:
cd /var/lib/jenkins/repos/weka-blog
COUNT=`git pull | grep -v "Already up-to-date" | wc -l`
if [ $COUNT -gt 0 ]
then
/bin/scl enable rh-python35 - << \EOF
cd /var/lib/jenkins/repos/weka-blog
/var/lib/jenkins/repos/weka-blog/venv/bin/nikola github_deploy
EOF
fi
For getting the jenkins user to deploy to github, you need to:
-
create an ssh key as user jenkins
ssh-keygen -t rsa -f ~/.ssh/github_wekablog
-
add the following to
~/.ssh/config
Host github-wekablog HostName github.com User git IdentityFile ~/.ssh/github_wekablog IdentitiesOnly yes
-
add the public ssh key under the repo's Settings -> Deploy keys with write access
-
update the
.git/config
file in the checked out repo, changing the remote origin URL to this (using the just created identity):url = git@github-wekablog:Waikato/weka-blog.git
-
posts go into the
posts
directory -
to make it easier to find posts, prefix them with the date (
yyyy-MM-dd-
) -
posts are written in reStructered Text
-
structure of a post
-
.. title: Advanced Weka MOOC started .. slug: 2018-05-07-advancedmoocstarted .. date: 2018-05-07 08:00:00 UTC+12:00 .. tags: mooc .. author: FracPete .. description: .. category: mooc
title
- is the human readable title of the postslug
- is the URL to be used for this postdate
- the date/time of the post (incl timezone)tags
- comma-separated list (tag1, tag2, ...
)author
- the author of the blog postdescription
- leave emptycategory
- post category, egmooc
orrelease
-
empty line
-
actual content
-
-
to avoid really long posts to clutter RSS feed and starting page, add the following special command after a few paragraphs:
.. TEASER_END
Here are some tools:
-
Online editors
-
Command-line tools
-
GUI editors
Links are a bit different in reStructured Text and it is easiest to simply use anonymous links:
`link text <link url>`__
Useful links: