Wordpress: why not?

The most of my websites are currently running on an up to date version of wordpress. They are hosted in a shared hosting environment and are completely separated. Most of the time there is one theme with customizations and multiple plugins like security, statistics or tag helpers. The downside of such a system is the potential security issue. More than that is the big part of my sites built with static content. So why use a application like wordpress? In my opinion it was the one system that I knew and that has a large community and support for almost everything. So I stayed with wordpress for a long time. There is nothing wrong with wordpress and I still like it a lot but I think it is to large for a small webpage or blog like mine.

Prezel

A friend of mine just sent me a link to pretzel . Pretzel is a tool to generate static html site from markdown-files. It is written in .net and claims itself compatible to Jekyll. So even if I’m working with Microsoft and writing .net code, I try not to use Microsoft products at home for multiple reasons. So I followed the link to the original Jekyll and did a small test. This new blog is the live test of it :-)

Jekyll

Jekyll can be found at https://jekyllrb.com . Finding a theme was not that difficult and to get it running on my arch system was quite easy as well. There is also a good documentation that helps to create a first empty jekyll website. The Quick start guide helped to get it running. A cool feature is that I can start jekyll on my local system as a development web server. It detects filechanges and regenerates the site automatically. So I have the complete page as a preview within my browser.

So in my opinion is static the new dynamic ;-)

Workflow

There is a way to work with multiple drafts by using a defined draft folder. This is ok but for me I like something more because using markdown and test files allows me to use a source control system. So I use gitflow for my posts.

My workflow looks like this:

  • First I create a new feature within SmartGit . This creates a local branch and checks it out.
  • Add the post contents (markdwon file, images, etc) and commit it
  • Merge finished post from feature branch to master
  • start deployment script which rebuilds the page from scratch and deploys it via ftp to the server

With this kind of workflow I may work on multiple articles and do not have any conflict with publishing them. I also have no problem with unfinished content because it does not get published. And the nice thing is that the whole content is versioned within a git repository.

deployment via ftp

Currently I deploy the page manually. Ok, ok, I do not really manually upload all the stuff. I searched with google and found a little script . Sure there is a goal to make this be triggered by a CI / CD system but this is another story and still in preparation. Until then I’m quite happy with this little solution.

#!/bin/bash
FTP_USERNAME='youruser'
FTP_URL='ftp://your-host-name.example.com'
TARGETFOLDER='/your/root/directory'
SOURCEFOLDER='_site/'

cd `dirname $0`
echo "Working directory: `pwd`"
if [[ `git status --porcelain` ]]; then
    echo "There are uncommitted changes."
    echo "Please commit any changes before deploying."
    exit 1
fi

echo "Running production build"
JEKYLL_ENV=production jekyll build || exit 1

echo "Deploying $SOURCEFOLDER to $TARGETFOLDER on $FTP_URL"
lftp -f "
open -u $FTP_USERNAME -e ls $FTP_URL || exit 1
mirror --reverse --delete --depth-first --overwrite --verbose $SOURCEFOLDER $TARGETFOLDER || exit 1
bye
" || exit 1
echo "Deploy completed successfully"