File indexing completed on 2024-11-15 10:02:47
0001 {% comment %}
0002 When rendering websites locally, `site.github.url` doesn't get resolved properly
0003 unless a GitHub Personal Access Token is set up and available in the
0004 environment. This leads to warnings and errors when trying to serve the site
0005 locally. To work around this, we use the `jekyll.environment` variable which is
0006 set to `development` when rendering the site locally, and set to `production` on
0007 GitHub where `site.github.url` is defined.
0008 {% endcomment %}
0009
0010 {% if jekyll.environment == "production" %}
0011
0012 {% comment %}
0013 First, get the name of the repository
0014 {% endcomment %}
0015 {% assign repo_name = site.github.repository_name %}
0016
0017 {% comment %}
0018 `site.github.public_repositories` contains comprehensive information for all public repositories for the organization. We use `where` to extract the part
0019 of the metadata that is relevant to the present repository.
0020 {% endcomment %}
0021 {% assign repo_info = site.github.public_repositories | where: "name", repo_name %}
0022
0023 {% comment %}
0024 Now, we can extract the default branch for the repo
0025 {% endcomment %}
0026 {% assign default_branch = repo_info[0].default_branch %}
0027
0028 {% comment %}
0029 Other variables requested by the template
0030 {% endcomment %}
0031 {% assign repo_url = site.github.repository_url %}
0032 {% assign search_domain_url = site.github.url %}
0033 {% assign project_title = site.github.project_title %}
0034 {% assign source_branch = site.github.source.branch %}
0035
0036 {% elsif jekyll.environment == "development" %}
0037
0038 {% assign repo_name = "" %}
0039 {% assign repo_url = "" %}
0040 {% assign default_branch = "" %}
0041 {% assign search_domain_url = "" %}
0042 {% assign project_title = "" %}
0043 {% assign source_branch = "" %}
0044
0045 {% endif %}