Skip to content

Commit

Permalink
Adding a 'root' variable to allow pages in sub-directories.
Browse files Browse the repository at this point in the history
@karawoo recently created a workshop website with a sub-directory for syllabus material. The `_layouts/page.html` template didn't work properly in this case because our included files have fixed relative paths to CSS and JS files. This PR adds the `root` variable, and references to it, where needed. It also moves the inclusion of `footer.html` to the right place (so that the footer spans the whole page).

Note that the `index.html` page already had an (unused) `root` variable.
  • Loading branch information
gvwilson committed Apr 18, 2015
1 parent 6003607 commit 0b53944
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions _includes/header.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<link rel="shortcut icon" type="image/x-icon" href="{{site.swc_site}}/v5/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" type="text/css" href="css/bootstrap/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="css/swc.css" />
<link rel="stylesheet" type="text/css" href="{{page.root}}/css/bootstrap/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="{{page.root}}/css/swc.css" />
<link rel="alternate" type="application/rss+xml" title="The Software Carpentry Blog" href="{{config.site}}/feed.xml"/>
<meta charset="UTF-8" />
<meta http-equiv="last-modified" content="{{site.timestamp}}" />
Expand Down
4 changes: 2 additions & 2 deletions _includes/javascript.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<!-- Javascript placed at the end of the document so the pages load faster. -->
<script src="js/jquery-1.9.1.min.js"></script>
<script src="css/bootstrap/bootstrap-js/bootstrap.js"></script>
<script src="{{page.root}}/js/jquery-1.9.1.min.js"></script>
<script src="{{page.root}}/css/bootstrap/bootstrap-js/bootstrap.js"></script>
8 changes: 4 additions & 4 deletions _layouts/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@
<!--
Use this layout for generic pages in the workshop website.
Use 'workshop.html' for the workshop home page.
Remember to set the variable 'root' in the header of the actual page.
-->
<html>
<head>
<title>Software Carpentry: {{ page.venue }}</title>
{% include header.html %}
</head>
<body class="workshop">

{% include github-ribbon.html %}

<div class="container card">
{% include banner.html %}
<div class="row">
<div class="col-md-10 col-md-offset-1">
{{content}}
{% include footer.html %}
</div>
</div>
{% include footer.html %}
</div>
</div>
{% include javascript.html %}
</body>
Expand Down
1 change: 1 addition & 0 deletions setup/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: page
title: Testing Setup
root: ..
---
For Learners
------------
Expand Down

0 comments on commit 0b53944

Please sign in to comment.