forked from LibraryCarpentry/lc-open-refine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace page.root (LibraryCarpentry#310)
* replace page.root with 'base' variable that knows path level * deal with case of trailing / in URL * use link to figure out path for logos * simplify path building for favicons * baseurl isn't used in our template so it can removed * use 'base' variable for path root instead of unecessary http request to site.url * replace page.root with 'base' variable that knows path level * deal with case of trailing / in URL * use link to figure out path for logos * simplify path building for favicons * baseurl isn't used in our template so it can removed * use 'base' variable for path root instead of unecessary http request to site.url * rename variable, consolidate comments * rename variable in template files
- Loading branch information
1 parent
c9fe2d8
commit 39ed62b
Showing
13 changed files
with
70 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{% comment %} | ||
This is adapated from: https://ricostacruz.com/til/relative-paths-in-jekyll | ||
|
||
`page.url` gives the URL of the current page with a leading /: | ||
|
||
- when the URL ends with the extension (e.g., /foo/bar.html) then we can get | ||
the depth by counting the number of / and remove - 1 | ||
- when the URL ends with a / (e.g. /foo/bar/) then the number / gives the depth | ||
directly | ||
{% endcomment %} | ||
|
||
{% assign relative_root_path = '' %} | ||
|
||
{% assign last_char = page.url | slice: -1 %} | ||
|
||
{% if last_char == "/"} | ||
{% assign offset = 0 %} | ||
{% else %} | ||
{% assign offset = 1 %} | ||
{% endif %} | ||
|
||
{% assign depth = page.url | split: '/' | size | minus: offset %} | ||
{% if depth <= 1 %}{% assign relative_root_path = '.' %} | ||
{% elsif depth == 2 %}{% assign relative_root_path = '..' %} | ||
{% elsif depth == 3 %}{% assign relative_root_path = '../..' %} | ||
{% elsif depth == 4 %}{% assign relative_root_path = '../../..' %} | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{% comment %} | ||
Main title for lesson pages. | ||
{% endcomment %} | ||
<h1 class="maintitle"><a href="{{ page.root }}{% link index.md %}">{{ site.title }}</a>{% if page.title %}: {{ page.title }}{% endif %}</h1> | ||
<h1 class="maintitle"><a href="{{ relative_root_path }}{% link index.md %}">{{ site.title }}</a>{% if page.title %}: {{ page.title }}{% endif %}</h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters