From b84e6ac5b787b831c496780d14bcc73242d8e172 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fran=C3=A7ois=20Michonneau?= Date: Tue, 14 Aug 2018 17:58:44 -0400 Subject: [PATCH] use site.github.url only in production --- _layouts/base.html | 18 +++++++++++++++++- bin/boilerplate/_config.yml | 4 ---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/_layouts/base.html b/_layouts/base.html index 99d6567..8a2e4b5 100644 --- a/_layouts/base.html +++ b/_layouts/base.html @@ -1,5 +1,21 @@ --- --- + +{% comment %} +When rendering websites locally, `site.github.url` doesn't get resolved +properly unless GitHub PAT are set up and available in the environment. +This leads to warnings and errors when trying to serve the site locally. +To work around this, we use the `jekyll.environment` variable which is set to +`development` when rendering the site locally, and set to `production` on +GitHub where `site.github.url` will be defined. +{% endcomment %} + +{% if jekyll.environment == "development" %} +{% assign search_domain_url = "" %} +{% elsif jekyll.environment == "production" %} +{% assign search_domain_url = site.github.url %} +{% endif %} + @@ -8,7 +24,7 @@ - + diff --git a/bin/boilerplate/_config.yml b/bin/boilerplate/_config.yml index 35e2cf1..795a35c 100644 --- a/bin/boilerplate/_config.yml +++ b/bin/boilerplate/_config.yml @@ -94,7 +94,3 @@ exclude: # Turn on built-in syntax highlighting. highlighter: rouge - -# Allow local rendering around github metadata -# from: https://github.com/github/pages-gem/issues/399#issuecomment-301827749 -github: [metadata] -- 2.30.2