GitHub Pagesでリポジトリのメタデータを表示する

GitHub Pagesでリポジトリ一覧を表示したいなーでもAPIからデータを取得しないとダメだろうし、 と思っていたら変数として参照できるというのを知ったのでメモ。

Repository metadata on GitHub Pagesにある通り。 以下は{{ site.github.public_repositories }}で出力したうちの一部。

{
  "id"=>30493517,
  "name"=>"amd-with-requirejs",
  "full_name"=>"sasaplus1-prototype/amd-with-requirejs",
  "owner"=>{
    "login"=>"sasaplus1-prototype",
    "id"=>10500801,
    "avatar_url"=>"https://avatars.githubusercontent.com/u/10500801?v=3",
    "gravatar_id"=>"",
    "url"=>"https://api.github.com/users/sasaplus1-prototype",
    "html_url"=>"https://github.com/sasaplus1-prototype",
    "followers_url"=>"https://api.github.com/users/sasaplus1-prototype/followers",
    "following_url"=>"https://api.github.com/users/sasaplus1-prototype/following{/other_user}",
    "gists_url"=>"https://api.github.com/users/sasaplus1-prototype/gists{/gist_id}",
    "starred_url"=>"https://api.github.com/users/sasaplus1-prototype/starred{/owner}{/repo}",
    "subscriptions_url"=>"https://api.github.com/users/sasaplus1-prototype/subscriptions",
    "organizations_url"=>"https://api.github.com/users/sasaplus1-prototype/orgs",
    "repos_url"=>"https://api.github.com/users/sasaplus1-prototype/repos",
    "events_url"=>"https://api.github.com/users/sasaplus1-prototype/events{/privacy}",
    "received_events_url"=>"https://api.github.com/users/sasaplus1-prototype/received_events",
    "type"=>"Organization",
    "site_admin"=>false
  },
  "private"=>false,
  "html_url"=>"https://github.com/sasaplus1-prototype/amd-with-requirejs",
  "description"=>"AMD sample with RequireJS",
  "fork"=>false,
  "url"=>"https://api.github.com/repos/sasaplus1-prototype/amd-with-requirejs",
  "forks_url"=>"https://api.github.com/repos/sasaplus1-prototype/amd-with-requirejs/forks",
  "keys_url"=>"https://api.github.com/repos/sasaplus1-prototype/amd-with-requirejs/keys{/key_id}",
  "collaborators_url"=>"https://api.github.com/repos/sasaplus1-prototype/amd-with-requirejs/collaborators{/collaborator}",
  "teams_url"=>"https://api.github.com/repos/sasaplus1-prototype/amd-with-requirejs/teams",
  "hooks_url"=>"https://api.github.com/repos/sasaplus1-prototype/amd-with-requirejs/hooks",
  "issue_events_url"=>"https://api.github.com/repos/sasaplus1-prototype/amd-with-requirejs/issues/events{/number}",
  "events_url"=>"https://api.github.com/repos/sasaplus1-prototype/amd-with-requirejs/events",
  "assignees_url"=>"https://api.github.com/repos/sasaplus1-prototype/amd-with-requirejs/assignees{/user}",
  "branches_url"=>"https://api.github.com/repos/sasaplus1-prototype/amd-with-requirejs/branches{/branch}",
  "tags_url"=>"https://api.github.com/repos/sasaplus1-prototype/amd-with-requirejs/tags",
  "blobs_url"=>"https://api.github.com/repos/sasaplus1-prototype/amd-with-requirejs/git/blobs{/sha}",
  "git_tags_url"=>"https://api.github.com/repos/sasaplus1-prototype/amd-with-requirejs/git/tags{/sha}",
  "git_refs_url"=>"https://api.github.com/repos/sasaplus1-prototype/amd-with-requirejs/git/refs{/sha}",
  "trees_url"=>"https://api.github.com/repos/sasaplus1-prototype/amd-with-requirejs/git/trees{/sha}",
  "statuses_url"=>"https://api.github.com/repos/sasaplus1-prototype/amd-with-requirejs/statuses/{sha}",
  "languages_url"=>"https://api.github.com/repos/sasaplus1-prototype/amd-with-requirejs/languages",
  "stargazers_url"=>"https://api.github.com/repos/sasaplus1-prototype/amd-with-requirejs/stargazers",
  "contributors_url"=>"https://api.github.com/repos/sasaplus1-prototype/amd-with-requirejs/contributors",
  "subscribers_url"=>"https://api.github.com/repos/sasaplus1-prototype/amd-with-requirejs/subscribers",
  "subscription_url"=>"https://api.github.com/repos/sasaplus1-prototype/amd-with-requirejs/subscription",
  "commits_url"=>"https://api.github.com/repos/sasaplus1-prototype/amd-with-requirejs/commits{/sha}",
  "git_commits_url"=>"https://api.github.com/repos/sasaplus1-prototype/amd-with-requirejs/git/commits{/sha}",
  "comments_url"=>"https://api.github.com/repos/sasaplus1-prototype/amd-with-requirejs/comments{/number}",
  "issue_comment_url"=>"https://api.github.com/repos/sasaplus1-prototype/amd-with-requirejs/issues/comments{/number}",
  "contents_url"=>"https://api.github.com/repos/sasaplus1-prototype/amd-with-requirejs/contents/{+path}",
  "compare_url"=>"https://api.github.com/repos/sasaplus1-prototype/amd-with-requirejs/compare/{base}...{head}",
  "merges_url"=>"https://api.github.com/repos/sasaplus1-prototype/amd-with-requirejs/merges",
  "archive_url"=>"https://api.github.com/repos/sasaplus1-prototype/amd-with-requirejs/{archive_format}{/ref}",
  "downloads_url"=>"https://api.github.com/repos/sasaplus1-prototype/amd-with-requirejs/downloads",
  "issues_url"=>"https://api.github.com/repos/sasaplus1-prototype/amd-with-requirejs/issues{/number}",
  "pulls_url"=>"https://api.github.com/repos/sasaplus1-prototype/amd-with-requirejs/pulls{/number}",
  "milestones_url"=>"https://api.github.com/repos/sasaplus1-prototype/amd-with-requirejs/milestones{/number}",
  "notifications_url"=>"https://api.github.com/repos/sasaplus1-prototype/amd-with-requirejs/notifications{?since,all,participating}",
  "labels_url"=>"https://api.github.com/repos/sasaplus1-prototype/amd-with-requirejs/labels{/name}",
  "releases_url"=>"https://api.github.com/repos/sasaplus1-prototype/amd-with-requirejs/releases{/id}",
  "created_at"=>"2015-02-08 14:30:24 UTC",
  "updated_at"=>"2015-02-08 15:06:46 UTC",
  "pushed_at"=>"2015-02-08 15:06:04 UTC",
  "git_url"=>"git://github.com/sasaplus1-prototype/amd-with-requirejs.git",
  "ssh_url"=>"git@github.com:sasaplus1-prototype/amd-with-requirejs.git",
  "clone_url"=>"https://github.com/sasaplus1-prototype/amd-with-requirejs.git",
  "svn_url"=>"https://github.com/sasaplus1-prototype/amd-with-requirejs",
  "homepage"=>"http://sasaplus1-prototype.github.io/amd-with-requirejs/",
  "size"=>104,
  "stargazers_count"=>0,
  "watchers_count"=>0,
  "language"=>"JavaScript",
  "has_issues"=>true,
  "has_downloads"=>true,
  "has_wiki"=>true,
  "has_pages"=>true,
  "forks_count"=>0,
  "mirror_url"=>nil,
  "open_issues_count"=>0,
  "forks"=>0,
  "open_issues"=>0,
  "watchers"=>0,
  "default_branch"=>"gh-pages",
  "permissions"=>{
    "admin"=>true,
    "push"=>true,
    "pull"=>true
  }
}

これでforでループすればリポジトリ一覧が表示できる。