Markdown table sucks. Let's use jekyll's data files instead

Creating a table in markdown sucks, especially if the table is quite big with some styled elements. Back before knowing data files, I came up with a plugin to help with this. First, I create folder to keep my JSON data files. I wrapped it in a simple plugin to generate inline javascript call (AJAX) to render the table upon finish loading. {% jsontable myjsonfilename %} This works as expected but it’s only feasible for simple table structure.

Incremental regeneration in latest jekyll build

jekyll is an awesome static generator but its regenetion time is totally unexceptable. It works well when you have small number of posts but start to degrade as number of posts increases. Actually, I don’t care about it much when I git push to the repo because my VPS is using SSD-cached but previewing the site at localhost is such a pain. So when I take a look at jekyll again today and see this pull request, I’m so excited and couldn’t help but clone the repo and rebuild jekyll to test it out myself.

Create a contact form with jekyll

Since jekyll blog is static, we have to rely some some kind of service endpoint to send email to our mailbox. Good thing is that there are plenty of services for this purpose: heroku for free hosting and mailgun, mandrill or mailjet for sending email. Pick one of your choice. I did a quick search before firing up Sublime Text to create a simple app for sending email and luckily, someone already wrote one.

Using AngularJS with jekyll

This blog is running on jekyll; and since I’m learning AngularJS, I want to try AngularJS on my blog as well. The problem is both are using double curly braces syntax, jekyll will consume it first when generating and AngularJS will be left with nothing. In order to use AngularJS with jekyll, we have to instruct AngularJS to use different start and end symbol by using $interpolateProvider. var myApp = angular.

Using GitHub issue tracker as comment system for your static blog

Ivan Zuzak wrote about it here. It’s actually a very cool idea. All you need is to create a new repo on GitHub, create an issue for the blog post you want to enable comment and set commentIssueId in your blog post. A JavaScript ajax call will pull comments from GitHub on page load. If I were to enable comments on my blog, I would defenitely go this route. You already blog like a hacker, you should also comment like one.

A better sitemap for jekyll

jekyll sitemap use site.time for lastmod so it doesn’t really reflect the actual last modified date of the post but the last updated date of the site instead. I’m not so sure if lastmod attribute has much effect on Google’s crawl rate/SEO to your site since it’s optional but I’m a little picky even when it comes to small thing like this. Since last modified date is available from the source file, it should be generated automatically from that.

Localization with jekyll

Do you want to create a multilingual blog with jekyll? Here’s an easy way to setup jekyll to have content in multiple languages. Create localized string data file Create a folder named _data if you don’t already have one. Inside that folder, create a localization data file and name it messages.yml. mkdir _data touch messages.yml Edit messages.yml and add localized strings. For the moment, I will just create a simple phrase and 2 localized strings in English and Vietnamese for testing purpose.

Post scheduling with jekyll

First, update your _config.yml and set future to false. By doing this, jekyll will not publish any post with future date. future: false Setup a cronjob to check and rebuild the site if there’re posts to be published. Since I already setup a hook on post-receive (trigger on receving a git push) to rebuild the site, I’m going to set a cronjob to execute this script instead of writing something new.

jekyll full-text search without jQuery or plugin

I did a quick search for full-text search solutions for jekyll (or any static websites). A notable fews have come up in search result: jekyll-lunr-js-search index_tank tapir lunr-js-search A quick look at the plugin’s dependency, I give up right away even though I only need that on search page. For the very same reason I opted for jekyll - a static site generator, I want my site to load as fast as possible.