Replace page.root (#310)
[rnaseq-cwl-training.git] / _layouts / base.html
index 4eee9dcdaa6b1b6e994b9ae39188f48c863221ab..a083eb1f7bd8658f4f93d2bc5c3ba71ab7ac4c5d 100644 (file)
@@ -1,5 +1,22 @@
 ---
 ---
+{% 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 %}
+
+{% include base_path.html %}
+
 <!doctype html>
 <html lang="en">
   <head>
     <meta http-equiv="last-modified" content="{{ site.time }}">
     <meta name="viewport" content="width=device-width, initial-scale=1">
     <!-- meta "search-domain" used for google site search function google_search() -->
-    <meta name="search-domain" value="{{ site.github.url }}">
-    <link rel="stylesheet" type="text/css" href="{{ page.root }}/assets/css/bootstrap.css" />
-    <link rel="stylesheet" type="text/css" href="{{ page.root }}/assets/css/bootstrap-theme.css" />
-    <link rel="stylesheet" type="text/css" href="{{ page.root }}/assets/css/lesson.css" />
-    <link rel="stylesheet" type="text/css" href="{{ page.root }}/assets/css/syntax.css" />
-    {% if site.carpentry == "swc" %}
-    <link rel="shortcut icon" type="image/x-icon" href="{{ page.root }}/assets/img/favicon-swc.ico" />
-    {% elsif site.carpentry == "dc" %}
-    <link rel="shortcut icon" type="image/x-icon" href="{{ page.root }}/assets/img/favicon-dc.ico" />
-    {% elsif site.carpentry == "lc" %}
-    <link rel="shortcut icon" type="image/x-icon" href="{{ page.root }}/assets/img/favicon-lc.ico" />
-    {% endif %}
+    <meta name="search-domain" value="{{ search_domain_url }}">
+    <link rel="stylesheet" type="text/css" href="{{ relative_root_path }}/assets/css/bootstrap.css" />
+    <link rel="stylesheet" type="text/css" href="{{ relative_root_path }}/assets/css/bootstrap-theme.css" />
+    <link rel="stylesheet" type="text/css" href="{{ relative_root_path }}/assets/css/lesson.css" />
+    <link rel="stylesheet" type="text/css" href="{{ relative_root_path }}/assets/css/syntax.css" />
+
+    {% include favicons.html %}
+
     <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
     <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
     <!--[if lt IE 9]>
@@ -29,6 +42,9 @@
     <title>{{ site.title }}{% if page.title %}: {{ page.title }}{% endif %}</title>
   </head>
   <body>
+
+    {% include life_cycle.html %}
+
     <div class="container">
       {% include navbar.html %}
 {{ content }}