From 49e29b770b92f721c5a029c308253741ff43a99c Mon Sep 17 00:00:00 2001 From: Gibheer Date: Wed, 18 Nov 2015 21:39:31 +0100 Subject: [PATCH] add new blog post "new blog engine" Finally a new blog post out about the new blog engine! --- content/post/120.md | 104 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 content/post/120.md diff --git a/content/post/120.md b/content/post/120.md new file mode 100644 index 0000000..7de98c4 --- /dev/null +++ b/content/post/120.md @@ -0,0 +1,104 @@ ++++ +date = "2015-11-18T20:45:08+01:00" +draft = false +title = "new blog engine" +author = "Gibheer" + ++++ + +As you can see, the blog finally got a new design, because we came around to +actually work on it. + +So in this post, I will explain a bit, what we actually did and why we reworked +the blog yet again. + +history +------- + +The old blog engine was a self written system in ruby using [zero](https://github.com/libzero/zero). It worked +pretty well the first couple months. But it was on one side a huge pain to keep +up to date and on the other side, I didn't even get around to implement a nice +interface to write new blog entries. +Since then, every article was hand crafted in an editor and published by pushing +it into the database. + +new system +---------- + +For the new system, we decided to just avoid all the hassle and take the route +of a static pages for now. Despite the old blog never being updated, it still +was very fast and we did not want to loose that. + +With that, we decided on [hugo](http://gohugo.io/), just because it is easy to install and to keep +up to date, as the only thing to do, is to refresh the pages and copy them into +the correct directory. + +some implementation hassles +--------------------------- + +If you are trying to make the switch to hugo, here are some problems I found and +a solution. + +*1. RSS feed* + +The [RSS feed](https://gohugo.io/templates/rss/) can be adjusted in a separate +template, but the default one works okay. +Hugo will automatically create index.xml files, which represent the rss feeds, +for the sections and content index pages. You can overwrite the rss templates +to filter out content you don't want to have in there. + +If you want to completely disable the RSS feature, you can add the following +option to your [configuration](https://gohugo.io/overview/configuration/). + +``` +# Do not build RSS files +disableRSS: false +``` + +template calling +---------------- + +Hugo is a bit different in comparison to many other systems in how the templates +are called. +Instead of using central template and branching out from it, hugo calls +specific templates when it needs them and they have to include the files they +need, for example the header. + +You can create a directory [partials](https://gohugo.io/templates/partials/) and +place partial templates there to include in your main template, using `{{ partial "name.html" / }}`. + +To call other templates, use the _.Render_ function. + +The [documentation on templates](https://gohugo.io/templates/overview/) is pretty +good, when using some examples from other themes. + +As for this blogs theme, you can find everything on [our git](https://git.zero-knowledge.org/gibheer/zblog). + +taxonomies +---------- + +One can easily define taxonomies when creating a new content just by adding +a new key/value pair into the head of the content. + +These can then be accessed in the template through `{{ .Param.keyname }}`. + +Hugo creates automatically index pages for the taxonomies, which is rather nice. + +https support +------------- + +For https support you need to set the `baseurl` to an empty string. This way +all resources are referenced absolutely from the root directory. + +If you only have https or http, you can define the complete path in the +configuration. + +result +------ + +Till now, we are pretty please with the overall result. Building the pages works +very fast and the hugo server also embedds a small javascript to reload the page +when new context was added or saved. + +Everything we have built and used is available in the [git repository](https://git.zero-knowledge.org/gibheer/zblog), +so you can take a look there, how everything works.