GitHub Pages 博客文章导出JSON方法

Posted by 范东 on September 21, 2017

前言

很多人在github.io上寄存了自己的博客,比如

同时还有这么一小撮人,想在App展示博客文章的列表,比如

那么问题来了,如何使用GitHub生成的文章列表生成可用于App上呢,这里使用了常用的JSON数据额格式

第一步

在根目录创建.json格式文件 比如getArticleList.json

第二步

开始书写代码

因为我的文章头部一般都写这几个参数

---
layout:     post
title:      "GitHub Pages 博客文章导出JSON供App使用方法"
subtitle:   ""
date: 2017-09-21 11:32:00.000000000 +08:00
author:     "范东"
header-img: "img/post-bg-ios9-web.jpg"
catalog:    true
tags:
    - GitHub
    - GitHub.io
    - GitHub Pages
---

所以我们获取字段的时候一般也就获取这些字段(以下为getArticleList.json的内容)

---
layout: nil
---

[
    {
        "title":"一个漂亮的iOS Gitee客户端 - Giteer",
        "url":"http://blog.fandong.me/2021/09/21/Giteer/",
        "date":"21 Sep 2021",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"Gitee",
        "catalog":"true"
    },

    {
        "title":"我已经成为七牛合伙人",
        "url":"http://blog.fandong.me/2019/06/26/Invite-Qiniu/",
        "date":"26 Jun 2019",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"Invite",
        "catalog":"true"
    },

    {
        "title":"MySQL插入中文报错.1366问题解决办法",
        "url":"http://blog.fandong.me/2017/12/01/Vapor-MySQL.1366/",
        "date":"01 Dec 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"MySQL",
        "catalog":"true"
    },

    {
        "title":"GitHub Pages 博客文章导出JSON方法",
        "url":"http://blog.fandong.me/2017/09/21/GitHub-Pages-JSON/",
        "date":"21 Sep 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"GitHubGitHub.ioGitHub Pages",
        "catalog":"true"
    },

    {
        "title":"每日常用命令备注",
        "url":"http://blog.fandong.me/2017/09/01/Notes/",
        "date":"01 Sep 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"UbuntuMySQLECS",
        "catalog":"true"
    },

    {
        "title":"Markdown高级用法(嵌套音视频)",
        "url":"http://blog.fandong.me/2017/08/25/Markdown-Advance/",
        "date":"25 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"Markdown",
        "catalog":"true"
    },

    {
        "title":"iOS面试题 - 来自收发室科技",
        "url":"http://blog.fandong.me/2017/08/24/iOS-Interview/",
        "date":"24 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOS面试题",
        "catalog":"true"
    },

    {
        "title":"基于Swift的Web框架Vapor2.0文档(翻译)Debugging-Overview",
        "url":"http://blog.fandong.me/2017/08/24/iOS-SwiftVaporWeb34/",
        "date":"24 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSSwiftWebVapor",
        "catalog":"true"
    },

    {
        "title":"基于Swift的Web框架Vapor2.0文档(翻译)Debugging-Package",
        "url":"http://blog.fandong.me/2017/08/24/iOS-SwiftVaporWeb33/",
        "date":"24 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSSwiftWebVapor",
        "catalog":"true"
    },

    {
        "title":"基于Swift的Web框架Vapor2.0文档(翻译)Core-Overview",
        "url":"http://blog.fandong.me/2017/08/24/iOS-SwiftVaporWeb32/",
        "date":"24 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSSwiftWebVapor",
        "catalog":"true"
    },

    {
        "title":"基于Swift的Web框架Vapor2.0文档(翻译)Core-Package",
        "url":"http://blog.fandong.me/2017/08/24/iOS-SwiftVaporWeb31/",
        "date":"24 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSSwiftWebVapor",
        "catalog":"true"
    },

    {
        "title":"基于Swift的Web框架Vapor2.0文档(翻译)Validation-Overview",
        "url":"http://blog.fandong.me/2017/08/22/iOS-SwiftVaporWeb30/",
        "date":"22 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSSwiftWebVapor",
        "catalog":"true"
    },

    {
        "title":"基于Swift的Web框架Vapor2.0文档(翻译)Validation-Package",
        "url":"http://blog.fandong.me/2017/08/22/iOS-SwiftVaporWeb29/",
        "date":"22 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSSwiftWebVapor",
        "catalog":"true"
    },

    {
        "title":"基于Swift的Web框架Vapor2.0文档(翻译)HTTP-CORS",
        "url":"http://blog.fandong.me/2017/08/21/iOS-SwiftVaporWeb28/",
        "date":"21 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSSwiftWebVapor",
        "catalog":"true"
    },

    {
        "title":"基于Swift的Web框架Vapor2.0文档(翻译)HTTP-Server",
        "url":"http://blog.fandong.me/2017/08/21/iOS-SwiftVaporWeb27/",
        "date":"21 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSSwiftWebVapor",
        "catalog":"true"
    },

    {
        "title":"基于Swift的Web框架Vapor2.0文档(翻译)HTTP-Client",
        "url":"http://blog.fandong.me/2017/08/21/iOS-SwiftVaporWeb26/",
        "date":"21 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSSwiftWebVapor",
        "catalog":"true"
    },

    {
        "title":"iOS面试题 - 来自汽车之家",
        "url":"http://blog.fandong.me/2017/08/21/iOS-Interview/",
        "date":"21 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOS面试题",
        "catalog":"true"
    },

    {
        "title":"基于Swift的Web框架Vapor2.0文档(翻译)HTTP-Responder",
        "url":"http://blog.fandong.me/2017/08/21/iOS-SwiftVaporWeb25/",
        "date":"21 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSSwiftWebVapor",
        "catalog":"true"
    },

    {
        "title":"基于Swift的Web框架Vapor2.0文档(翻译)HTTP-ResponseRepresentable",
        "url":"http://blog.fandong.me/2017/08/20/iOS-SwiftVaporWeb24/",
        "date":"20 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSSwiftWebVapor",
        "catalog":"true"
    },

    {
        "title":"基于Swift的Web框架Vapor2.0文档(翻译)HTTP-Body",
        "url":"http://blog.fandong.me/2017/08/20/iOS-SwiftVaporWeb23/",
        "date":"20 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSSwiftWebVapor",
        "catalog":"true"
    },

    {
        "title":"iOS中显示中文的UIImagePickerController界面",
        "url":"http://blog.fandong.me/2017/08/18/iOS-UIImagePickerController/",
        "date":"18 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSUIImagePickerController",
        "catalog":"true"
    },

    {
        "title":"基于Swift的Web框架Vapor2.0文档(翻译)HTTP-Middleware",
        "url":"http://blog.fandong.me/2017/08/18/iOS-SwiftVaporWeb22/",
        "date":"18 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSSwiftWebVapor",
        "catalog":"true"
    },

    {
        "title":"基于Swift的Web框架Vapor2.0文档(翻译)HTTP-Response",
        "url":"http://blog.fandong.me/2017/08/17/iOS-SwiftVaporWeb21/",
        "date":"17 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSSwiftWebVapor",
        "catalog":"true"
    },

    {
        "title":"基于Swift的Web框架Vapor2.0文档(翻译)HTTP-Request",
        "url":"http://blog.fandong.me/2017/08/16/iOS-SwiftVaporWeb20/",
        "date":"16 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSSwiftWebVapor",
        "catalog":"true"
    },

    {
        "title":"基于Swift的Web框架Vapor2.0文档(翻译)HTTP-Package",
        "url":"http://blog.fandong.me/2017/08/15/iOS-SwiftVaporWeb19/",
        "date":"15 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSSwiftWebVapor",
        "catalog":"true"
    },

    {
        "title":"基于Swift的Web框架Vapor2.0文档(翻译)JWT-Overview",
        "url":"http://blog.fandong.me/2017/08/13/iOS-SwiftVaporWeb18/",
        "date":"13 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSSwiftWebVapor",
        "catalog":"true"
    },

    {
        "title":"基于Swift的Web框架Vapor2.0文档(翻译)JWT-Package",
        "url":"http://blog.fandong.me/2017/08/13/iOS-SwiftVaporWeb17/",
        "date":"13 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSSwiftWebVapor",
        "catalog":"true"
    },

    {
        "title":"基于Swift的Web框架Vapor2.0之MySQL模板",
        "url":"http://blog.fandong.me/2017/08/13/iOS-Vapor-MySQL/",
        "date":"13 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSSwiftWebVaporMySQL",
        "catalog":"true"
    },

    {
        "title":"基于Swift的Web框架Vapor2.0文档(翻译)Redis-Provider",
        "url":"http://blog.fandong.me/2017/08/12/iOS-SwiftVaporWeb16/",
        "date":"12 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSSwiftWebVapor",
        "catalog":"true"
    },

    {
        "title":"基于Swift的Web框架Vapor2.0文档(翻译)Redis-Package",
        "url":"http://blog.fandong.me/2017/08/12/iOS-SwiftVaporWeb15/",
        "date":"12 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSSwiftWebVapor",
        "catalog":"true"
    },

    {
        "title":"基于Swift的Web框架Vapor2.0文档(翻译)Cache-Overview",
        "url":"http://blog.fandong.me/2017/08/12/iOS-SwiftVaporWeb14/",
        "date":"12 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSSwiftWebVapor",
        "catalog":"true"
    },

    {
        "title":"基于Swift的Web框架Vapor2.0文档(翻译)Cache-Package",
        "url":"http://blog.fandong.me/2017/08/12/iOS-SwiftVaporWeb13/",
        "date":"12 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSSwiftWebVapor",
        "catalog":"true"
    },

    {
        "title":"基于Swift的Web框架Vapor2.0文档(翻译)Routing-Collection",
        "url":"http://blog.fandong.me/2017/08/12/iOS-SwiftVaporWeb12/",
        "date":"12 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSSwiftWebVapor",
        "catalog":"true"
    },

    {
        "title":"基于Swift的Web框架Vapor2.0文档(翻译)Routing-Group",
        "url":"http://blog.fandong.me/2017/08/12/iOS-SwiftVaporWeb11/",
        "date":"12 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSSwiftWebVapor",
        "catalog":"true"
    },

    {
        "title":"基于Swift的Web框架Vapor2.0文档(翻译)Routing-Parameters",
        "url":"http://blog.fandong.me/2017/08/09/iOS-SwiftVaporWeb10/",
        "date":"09 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSSwiftWebVapor",
        "catalog":"true"
    },

    {
        "title":"基于Swift的Web框架Vapor2.0文档(翻译)Routing-Overview",
        "url":"http://blog.fandong.me/2017/08/09/iOS-SwiftVaporWeb09/",
        "date":"09 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSSwiftWebVapor",
        "catalog":"true"
    },

    {
        "title":"基于Swift的Web框架Vapor2.0文档(翻译)Routing-Package",
        "url":"http://blog.fandong.me/2017/08/08/iOS-SwiftVaporWeb08/",
        "date":"08 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSSwiftWebVapor",
        "catalog":"true"
    },

    {
        "title":"基于Swift的Web框架Vapor2.0文档(翻译)Config",
        "url":"http://blog.fandong.me/2017/08/07/iOS-SwiftVaporWeb07/",
        "date":"07 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSSwiftWebVapor",
        "catalog":"true"
    },

    {
        "title":"基于Swift的Web框架Vapor2.0文档(翻译)Xcode",
        "url":"http://blog.fandong.me/2017/08/06/iOS-SwiftVaporWeb06/",
        "date":"06 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSSwiftWebVapor",
        "catalog":"true"
    },

    {
        "title":"基于Swift的Web框架Vapor2.0文档(翻译)Manual",
        "url":"http://blog.fandong.me/2017/08/06/iOS-SwiftVaporWeb05/",
        "date":"06 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSSwiftWebVapor",
        "catalog":"true"
    },

    {
        "title":"iOS面试题(答案) - 来自昆仑万维",
        "url":"http://blog.fandong.me/2017/08/05/iOS-interviewFromKunlunResult/",
        "date":"05 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSC面试",
        "catalog":"true"
    },

    {
        "title":"基于Swift的Web框架Vapor2.0文档(翻译)Hello,World",
        "url":"http://blog.fandong.me/2017/08/04/iOS-SwiftVaporWeb04/",
        "date":"04 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSSwiftWebVapor",
        "catalog":"true"
    },

    {
        "title":"基于Swift的Web框架Vapor2.0文档(翻译)Toolbox",
        "url":"http://blog.fandong.me/2017/08/04/iOS-SwiftVaporWeb03/",
        "date":"04 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSSwiftWebVapor",
        "catalog":"true"
    },

    {
        "title":"基于Swift的Web框架Vapor2.0文档(翻译)Install: Ubuntu",
        "url":"http://blog.fandong.me/2017/08/04/iOS-SwiftVaporWeb02/",
        "date":"04 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSSwiftWebVapor",
        "catalog":"true"
    },

    {
        "title":"基于Swift的Web框架Vapor2.0文档(翻译)Install: Mac OS",
        "url":"http://blog.fandong.me/2017/08/03/iOS-SwiftVaporWeb01/",
        "date":"03 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSSwiftWebVapor",
        "catalog":"true"
    },

    {
        "title":"基于Swift的Web框架Vapor2.0文档目录(翻译)",
        "url":"http://blog.fandong.me/2017/08/01/iOS-SwiftVaporWeb/",
        "date":"01 Aug 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSSwiftWebVapor",
        "catalog":"true"
    },

    {
        "title":"iOS集成阿里云移动数据分析遇到的问题",
        "url":"http://blog.fandong.me/2017/07/18/iOS-AliAnalitics/",
        "date":"18 Jul 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOS阿里云Runtime",
        "catalog":"true"
    },

    {
        "title":"PC上搭建简单的FTP服务器(仅用于局域网)",
        "url":"http://blog.fandong.me/2017/07/16/PC-FTP/",
        "date":"16 Jul 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"PCFTP",
        "catalog":"true"
    },

    {
        "title":"Mac OS上搭建简单的FTP服务器(仅用于局域网)",
        "url":"http://blog.fandong.me/2017/07/16/Mac-FTP/",
        "date":"16 Jul 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"MacFTP",
        "catalog":"true"
    },

    {
        "title":"iOS集成第三方登录可能会遇到的问题",
        "url":"http://blog.fandong.me/2017/07/09/iOS-social/",
        "date":"09 Jul 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOS",
        "catalog":"true"
    },

    {
        "title":"iOS面试题 - 来自昆仑万维",
        "url":"http://blog.fandong.me/2017/06/26/iOS-interview/",
        "date":"26 Jun 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOS面试",
        "catalog":"false"
    },

    {
        "title":"Nginx强制使用https访问(http跳转到https)",
        "url":"http://blog.fandong.me/2017/03/29/aliyun-https/",
        "date":"29 Mar 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"NginxHTTPHTTPS",
        "catalog":"true"
    },

    {
        "title":"iOS使用OpenCV进行图像切割你可能需要的Demo",
        "url":"http://blog.fandong.me/2017/03/09/iOS-opencv/",
        "date":"09 Mar 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"iOSOpenCV",
        "catalog":"true"
    },

    {
        "title":"阿里云虚拟主机和二级域名你可能不知道的事!",
        "url":"http://blog.fandong.me/2017/02/25/aliyun-second/",
        "date":"25 Feb 2017",
        "author":"范东",
        "header-img":"img/post-bg-ios9-web.jpg",
        "subtitle":"",
        "tags":"阿里云云虚拟主机",
        "catalog":"true"
    }

]

第三步

上传getArticleList.json到你github.io的仓库地址

第四步

验证

点击如下链接

http://fandongtongxue.github.io/getArticleList.json

第五步: 大功告成