Migrating to Phile CMS (Pico fork)



Pico has some performance issues which have shown itself on my Beaglebone Black. This could be remedied by using Pico's cache plugin, but that doesn't really fix the problem underneath. Then someone pointed me to Phile CMS, a Pico fork by some of its users whishing to speed up development.

So I decided to install it, copy the content over (yay for flat file CMSes) and see how I fared.

Pros

  • Better performance as demonstrated on their Github page and by perceived page loading times.
  • Community driven development - more coding, more fixes and (eventually) probably more features. I cannot comment on the state of the plugins.

Cons

  • Complex layout compared to Pico (3 CSS files).
  • No editing possible in the document root (web site will blank).
  • Blog theme (as stated by the author) is not recommended if you want to use Phile's caching features.
  • Pico's plugins won't work on Phile.

Issue #1 and #2 can be fixed or worked around rather easily. Here's how.

CSS

Something which some people might like but which annoyed me was the CSS styling of code blocks. The CSS contains highlighting code for multiple languages, and the highlighting is very colourful, which means it will only work against a black background. This does not fit my site's colour palette - in a set of understated colour accents, black sticks out. You cannot just remove the CSS file responsible for code highlighting; you need to add an entry to the main CSS:

pre code {
  display: block;
}

Without this, your code blocks will look ugly (and not like a code block, really). Looking at the page source code in the browser, you'll see the CSS file in the theme's root dir is not called, so you can toss that out safely.

In-place editing

I whipped up a little Bash script for this (drop this in your .bashrc or related file for ease of use):

bledit() {
  if [ -e "${1/.md}" ]
  then
    vim "${1/.md/}"
  else
    cp "$1" "${1/.md/}"
    vim "${1/.md/}"
  fi

  echo '##'
  echo '## Differences between original and new edit:'
  echo -e '## \n'
  diff -Naur "$1" "${1/.md/}"
  echo '## Do you want to replace the original with the new edit? (y/n)'
  read ANSWER

  if [ $ANSWER = 'y' ]
  then
    mv "${1/.md/}" "$1"
  elif [ $ANSWER = 'n' ]
  then
    echo '## Not replacing original. The working copy will NOT be deleted.'
    echo '## Future edits will use the working copy unless you remove it'
    echo '## manually!'
  else
    echo "Valid answers are y(es) or n(o)."
  fi

  unset ANSWER
  }

VoilĂ . Piece of cake. Now you call $ bledit phile_migration.md and you'll be working on a copy (without .md suffix, so Phile won't choke on your edit). Save, exit, and you'll get a diff to show the edits made, and the script will ask you to replace (or not). If you do not replace, the script will leave the working copy in place, and will pick it up again when you resume editing next time. Make sure to remove the working copy manually if you do not want this. You can, of course, replace vim with whatever editor you prefer, and diff with colordiff for more readable output.

It took me some time, but I have migrated this blog to Phile now, mimicking the layout of the (adapted) Pico theme I used. Caching needs some looking into, but even without the site is pretty responsive. If you're interested in the theme, you can grab it here.