Skip to content

Instantly share code, notes, and snippets.

@roachhd
Created November 30, 2014 00:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roachhd/01e60e40f90be18d6151 to your computer and use it in GitHub Desktop.
Save roachhd/01e60e40f90be18d6151 to your computer and use it in GitHub Desktop.
GitHub Pages Meta

Repository metadata on GitHub Pages

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

Available repository metadata

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

{
    "versions": {
        "jekyll": "1.5.1",
        "kramdown": "1.3.1",
        "liquid": "2.5.5",
        "maruku": "0.7.0",
        "rdiscount": "2.1.7",
        "redcarpet": "2.3.0",
        "RedCloth": "4.2.9",
        "jemoji": "0.1.0",
        "jekyll-mentions": "0.0.6",
        "jekyll-redirect-from": "0.3.1",
        "jekyll-sitemap": "0.2.0",
        "github-pages": "18",
        "ruby": "2.1.1"
    },
    "hostname": "github.com",
    "pages_hostname": "github.io",
    "api_url": "https://api.github.com",
    "environment": "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)
    "contributors": [ User Objects ]
}

For more information on the contents of the repository and user objects, see the List organization repositories, Members list, and List contributors API endpoints.

The above is an example of site.github's typical contents. For an up to date list of GitHub Pages's dependencies and their versions, see pages.github.com/versions.

Usage

Reference any of the above keys as you would any other site configuration value present in your _config.yml file, e.g., The project is called {{ site.github.project_title }}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment