10000 Merge pull request #171 from jekyll/document-each-field · jekyll/github-metadata@48b972b · GitHub
[go: up one dir, main page]

Skip to content

Commit 48b972b

Browse files
authored
Merge pull request #171 from jekyll/document-each-field
List the fields this repo generates for site.github
2 parents 4da8b46 + 0db7c70 commit 48b972b

File tree

2 files changed

+86
-1
lines changed

2 files changed

+86
-1
lines changed

docs/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Jekyll plugin to propagate the `site.github` namespace and set default values fo
1111

1212
## What it does
1313

14-
* Propagates the `site.github` namespace with [repository metadata](https://help.github.com/articles/repository-metadata-on-github-pages/)
14+
* Propagates the `site.github` namespace with [repository metadata](site.github.md)
1515
* Sets `site.title` as the repository name, if none is set
1616
* Sets `site.description` as the repository tagline if none is set
1717
* Sets `site.url` as the GitHub Pages domain (cname or user domain), if none is set
@@ -41,4 +41,5 @@ Then go ahead and run `bundle install`. Once you've done that jekyll-github-meta
4141

4242
* [Authentication](authentication.md)
4343
* [Configuration](configuration.md)
44+
* [Using `site.github`](site.github.md)
4445
* [Edit on GitHub link](edit-on-github-link.md)

docs/site.github.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
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

Comments
 (0)
0