Article version: Enterprise Server 2.14

This version of GitHub Enterprise will be discontinued on This version of GitHub Enterprise was discontinued on 2019-07-12. No patch releases will be made, even for critical security issues. For better performance, improved security, and new features, upgrade to the latest version of GitHub Enterprise. For help with the upgrade, contact GitHub Enterprise support.

Repository metadata on GitHub Pages

GitHub Pages is available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server.

Common repository information, such as the project name and description, is available to Jekyll sites hosted on GitHub Pages.

Usage

Repository metadata is exposed to your Jekyll site's configuration in the site.github namespace.

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.

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:

{% for repository in site.github.public_repositories %}
  * [{{ repository.name }}]({{ repository.html_url }})
{% endfor %}

Using repository metadata locally

To recreate the site.github namespace locally, ensure you have the latest version of the GitHub Pages Gem installed, and that you have the following line in your site's _config.yml file:

repository: <USERNAME>/<PROJECT>

Some metadata fields, such as your branch name, may require additional authentication. Follow the GitHub Metadata plugin documentation to provide the appropriate credentials by creating a personal access token, and selecting the public_repo scope in step five.

Available repository metadata

Note: For the latest dependency versions see "GitHub Pages Dependencies Versions."

The following sample information is exposed to Jekyll templates in the site.github namespace:

{
    "versions": {
        "jekyll": <version>,
        "kramdown": <version>,
        "liquid": <version>,
        "maruku": <version>,
        "rdiscount": <version>,
        "redcarpet": <version>,
        "RedCloth": <version>,
        "jemoji": <version>,
        "jekyll-mentions": <version>,
        "jekyll-redirect-from": <version>,
        "jekyll-sitemap": <version>,
        "github-pages": <version>,
        "ruby": <version>"
    },
    "hostname": "github.com",
    "pages_hostname": "github.io",
    "api_url": "https://api.github.com",
    "help_url": "https://help.github.com",
    "environment": "dotcom",
    "pages_env": "dotcom",
    "public_repositories": [ Repository Objects ],
    "organization_members": [ User Objects ],
    "build_revision": "cbd866ebf142088896cbe71422b949de7f864bce",
    "project_title": "metadata-example",
    "project_tagline": "A GitHub Pages site to showcase repository metadata",
    "owner_name": "github",
    "owner_url": "https://github.com/github",
    "owner_gravatar_url": "https://github.com/github.png",
    "repository_url": "https://github.com/github/metadata-example",
    "repository_nwo": "github/metadata-example",
    "repository_name": "metadata-example",
    "zip_url": "https://github.com/github/metadata-example/zipball/gh-pages",
    "tar_url": "https://github.com/github/metadata-example/tarball/gh-pages",
    "clone_url": "https://github.com/github/metadata-example.git",
    "releases_url": "https://github.com/github/metadata-example/releases",
    "issues_url": "https://github.com/github/metadata-example/issues",
    "wiki_url": "https://github.com/github/metadata-example/wiki",
    "language": null,
    "is_user_page": false,
    "is_project_page": true,
    "show_downloads": true,
    "url": "http://username.github.io/metadata-example", // (or the CNAME)
    "baseurl": "/metadata-example",
    "contributors": [ User Objects ],
    "releases": [ Release Objects ],
    "latest_release": [ Release Object ],
    "private": false,
    "license": {
      "key": "mit",
      "name": "MIT License",
      "spdx_id": "MIT",
      "url": "https://api.github.com/licenses/mit"
    },
    "source": {
      "branch": "gh-pages",
      "path": "/"
    }
}

For more information on the contents of the repository and user objects, see these API endpoints:

Ask a human

Can't find what you're looking for?

Contact us