The code is written and put on Github. Follow the instruction to try it out!

A demo site showing more details.

Problem

Writing an article in Markdown in Vim is not really convenient, neither managing articles. I'd like to have a Liquid tag in Jekyll to sync my other articles to this personal site freely with a single post URL provided.

Then I would enjoy the benefits of:

  • Keep one copy of each of my articles
  • No need to write Markdown/HTML in Vim, especially when I need to write Chinese
  • If I'd not like to maintain this site, my articles are saved, no migration
  • WYSIWYG when I write on other platforms
  • Maintain the independence of my site
  • ...

And... a cool Gem!

Again, Jekyll is great, but it is also not perfect, nothing is perfect.

Solution

From high level it is super simple.

  1. Get the page content
  2. Make the HTML looks alright, with the help from Nokogiri. So far <img> is the hardest, but not hard at all
  3. Inject the new HTML as the content into Jekyll layouts

How does it Look Like

DISCLAIMER: the post in demo DOES NOT represent the post author's opinion and its copyright belongs to the original author.

Origin post from Wechat platform

Wechat Origin Post

Synced post on Jekyll site

Synced Post

Supports

Currently supports

What I learned

  • Create and publish a Ruby Gem
  • Revisited learned skills of Ruby
  • Some pattern design in designing the classes
  • Nokogiri lib and revisited XPath

I'm adding supports for more sites during my spare time. Leave a comment if you need help.