|
| 1 | +## Using `site.github` |
| 2 | + |
| 3 | +Common repository information, such as the project name and description, is available to Jekyll sites using `jekyll-github-metadata` including GitHub Pages sites. |
| 4 | + |
| 5 | +#### Usage |
| 6 | + |
| 7 | +Repository metadata is exposed to your Jekyll site's configuration in the `site.github` namespace. |
| 8 | + |
| 9 | +Simply, reference any of the below keys as you would any other site configuration value present in your `_config.yml` file, prefacing the key with `site.github`. |
| 10 | + |
| 11 | +For example, to list a project's name, you might write something like `The project is called {{ site.github.project_title }}` or to list an organization's open source repositories, you might use the following: |
| 12 | + |
| 13 | +```liquid |
| 14 | +{% for repository in site.github.public_repositories %} |
| 15 | + * [{{ repository.name }}]({{ repository.html_url }}) |
| 16 | +{% endfor %} |
| 17 | +``` |
| 18 | + |
| 19 | +#### Available repository metadata |
| 20 | + |
| 21 | +The following sample information is exposed to Jekyll templates in the `site.github` namespace: |
| 22 | + |
| 23 | +```text |
| 24 | +{ |
| 25 | + "versions": { |
| 26 | + "jekyll": <version>, |
| 27 | + "kramdown": <version>, |
| 28 | + "liquid": <version>, |
| 29 | + "maruku": <version>, |
| 30 | + "rdiscount": <version>, |
| 31 | + "redcarpet": <version>, |
| 32 | + "RedCloth": <version>, |
| 33 | + "jemoji": <version>, |
| 34 | + "jekyll-mentions": <version>, |
| 35 | + "jekyll-redirect-from": <version>, |
| 36 | + "jekyll-sitemap": <version>, |
| 37 | + "github-pages": <version>, |
| 38 | + "ruby": <version>" |
| 39 | + }, |
| 40 | + "hostname": "github.com", |
| 41 | + "pages_hostname": "github.io", |
| 42 | + "api_url": "https://api.github.com", |
| 43 | + "help_url": "https://help.github.com", |
| 44 | + "environment": "dotcom", |
| 45 | + "pages_env": "dotcom", |
| 46 | + "public_repositories": [ Repository Objects ], |
| 47 | + "organization_members": [ User Objects ], |
| 48 | + "build_revision": "cbd866ebf142088896cbe71422b949de7f864bce", |
| 49 | + "project_title": "metadata-example", |
| 50 | + "project_tagline": "A GitHub Pages site to showcase repository metadata", |
| 51 | + "owner_name": "github", |
| 52 | + "owner_url": "https://github.com/github", |
| 53 | + "owner_gravatar_url": "https://github.com/github.png", |
| 54 | + "repository_url": "https://github.com/github/metadata-example", |
| 55 | + "repository_nwo": "github/metadata-example", |
| 56 | + "repository_name": "metadata-example", |
| 57 | + "zip_url": "https://github.com/github/metadata-example/zipball/gh-pages", |
| 58 | + "tar_url": "https://github.com/github/metadata-example/tarball/gh-pages", |
| 59 | + "clone_url": "https://github.com/github/metadata-example.git", |
| 60 | + "releases_url": "https://github.com/github/metadata-example/releases", |
| 61 | + "issues_url": "https://github.com/github/metadata-example/issues", |
| 62 | + "wiki_url": "https://github.com/github/metadata-example/wiki", |
| 63 | + "language": null, |
| 64 | + "is_user_page": false, |
| 65 | + "is_project_page": true, |
| 66 | + "show_downloads": true, |
| 67 | + "url": "http://username.github.io/metadata-example", // (or the CNAME) |
| 68 | + "baseurl": "/metadata-example", |
| 69 | + "contributors": [ User Objects ], |
| 70 | + "releases": [ Release Objects ], |
| 71 | + "latest_release": [ Release Object ], |
| 72 | + "private": false, |
| 73 | + "license": { |
| 74 | + "key": "mit", |
| 75 | + "name": "MIT License", |
| 76 | + "spdx_id": "MIT", |
| 77 | + "url": "https://api.github.com/licenses/mit" |
| 78 | + }, |
| 79 | + "source": { |
| 80 | + "branch": "gh-pages", |
| 81 | + "path": "/" |
| 82 | + } |
| 83 | +} |
| 84 | +``` |
0 commit comments