Code Monkey home page Code Monkey logo

jekyll-artisync's Introduction

jekyll-artisync

MIT License Gem Version

Jekyll Plugin to sync articles from other sites. A simple demo site showing how it works.

Introduction

jekyll-artisync is a customized Liquid template tag to fetch an article from a given URL and feed as the content of your Jekyll site post.

Why built it

Jekyll is awesome, don't get me wrong.

I just found writing Markdown in Vim is not enjoyable, especially when I need to write Chinese sometimes (Vim key bindings doesn't work while use Chinese input). Besides, writing Jekyll post is local. It will be nice to sync from a post that I write online with a WYSIWYG editor, while I maintain the independence of my personal site.

General idea

  • Fetch the content of a given URL
  • Locate the post body
  • Feed it into Jekyll content

Therefore using a customized Liquid tag seems is the best solution.

Installation

Add this line to your Gemfile:

group :jekyll_plugins do
  ...
  gem "jekyll-artisync"
end

And then execute:

$ bundle install

How to use it

  • Create a normal post under _posts directory, for example 2020-05-20-foo-bar-post.md with your favorite template in front matter
  • As for content, apply the tag with supported url. For example, {% artisync https://zhuanlan.zhihu.com/p/<post id> %} will be sufficient
  • Run jekyll s in terminal and wait for Jekyll to build the site and run the server
  • Go to localhost:<port> (default port is 4000), you should be able to see the article fetched and displayed
  • Deploy your change to your website host

Syntax and Support List

{% artisync <your post url> %}

Or add the url in your front matter and reference it in Liquid, such as:

---
...
post_url: <your post url>

---

{% artisync {{page.post_url}} %}

Here is a list of current supported hosts:

Hosts
https://blog.csdn.net
https://www.jianshu.com
https://medium.com
https://mp.weixin.qq.com
https://zhuanlan.zhihu.com

Next Steps

Please refer to issues of this repo.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.