Snippet: sorting on custom date in Jekyll

On my blog I want to tag certain posts as “work” so that I can create a separate page that serves as a portfolio of my work. Because the date of the post isn’t always the date of the work I’ve done, some customisations were needed that were not directly available on the web or the Jekyll documentation.

I’ve added a category and custom date to the post’s front matter:

category: work
work_date: 2015-01-01 # format = YYYY-MM-DD

This gives us the necessary information to create a list of posts and a date to order them by. To solve the sorting issue, I used the following code:

{% assign sorted_posts = (site.categories.work | sort: 'work_date') %}
{% for post in sorted_posts reversed %}
<!-- your post here --> 
{% endfor %}

May it serve you well.

Snippet: Youtube videos in Jekyll - no plugins required

This solution utilises the ability to pass parameters to included files. You can pass the video ID to a generic YouTube embed code used on all pages.

Create file _includes/youtube.html containing the following code:

<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/{{ include.id }}?rel=0&amp;showinfo=0" frameborder="0" allowfullscreen></iframe>

Note: this uses the “privacy enhanced mode” and only the YouTube video ID has been parametrised.

To embed a Youtube video, use this in your posts:

{% include youtube.html id="_G790yZA5CA" %}

This is not a blog

So, I decided to bite the bullet and start blogging. Yes, I know. Another blog. And now I’m going to convince you this is not just another blog.

Because: this is not a blog.

Instead, I consider this “blog” a living portfolio and cabinet of curiosities - primarily focused on providing information to:

  • my professional network
  • friends
  • family
  • those who stumble upon my blog through a Google search.
1456