2 When rendering websites locally, `site.github.url` doesn't get resolved properly
3 unless a GitHub Personal Access Token is set up and available in the
4 environment. This leads to warnings and errors when trying to serve the site
5 locally. To work around this, we use the `jekyll.environment` variable which is
6 set to `development` when rendering the site locally, and set to `production` on
7 GitHub where `site.github.url` is defined.
10 {% if jekyll.environment == "production" %}
13 First, get the name of the repository
15 {% assign repo_name = site.github.repository_name %}
18 `site.github.public_repositories` contains comprehensive information for all public repositories for the organization. We use `where` to extract the part
19 of the metadata that is relevant to the present repository.
21 {% assign repo_info = site.github.public_repositories | where: "name", repo_name %}
24 Now, we can extract the default branch for the repo
26 {% assign default_branch = repo_info[0].default_branch %}
29 Other variables requested by the template
31 {% assign repo_url = site.github.repository_url %}
32 {% assign search_domain_url = site.github.url %}
33 {% assign project_title = site.github.project_title %}
34 {% assign source_branch = site.github.source.branch %}
36 {% elsif jekyll.environment == "development" %}
38 {% assign repo_name = "" %}
39 {% assign repo_url = "" %}
40 {% assign default_branch = "" %}
41 {% assign search_domain_url = "" %}
42 {% assign project_title = "" %}
43 {% assign source_branch = "" %}