- commit
- cfdde6592202e6c06691c11646e2afd6db79625a
- parent
- 47fc7536c23d0a02e4527cc6ebc46f2c8777dc5b
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2018-10-25 12:13
make path available in template
Diffstat
| M | README.md | 1 | + |
| M | api.php | 1 | + |
| M | themes/default/default.html | 3 | +-- |
3 files changed, 3 insertions, 2 deletions
diff --git a/README.md b/README.md
@@ -71,6 +71,7 @@ a dot in their name can consequently not have subpages.) 71 71 [Twig](https://twig.symfony.com/) is used as templating system. The following 72 72 variables are available in a template: 73 73 -1 74 - `path` - path to current page 74 75 - `page` - the data from the page's yaml file 75 76 - `body` - the contents of the page's markdown file 76 77 - `site` - the data from `/_content/_site.yml
diff --git a/api.php b/api.php
@@ -185,6 +185,7 @@ class Pupupu 185 185 186 186 $template = $page['_template'] ?? 'default.html'; 187 187 $html = $this->twig->render($template, array( -1 188 'path' => $path, 188 189 'page' => $page, 189 190 'site' => $site, 190 191 'body' => $body,
diff --git a/themes/default/default.html b/themes/default/default.html
@@ -14,9 +14,8 @@ 14 14 <a href="/" rel="home"><img src="/files/logo.jpg" class="logo" alt="{{ site.title }}"></a> 15 15 16 16 <nav>17 -1 <a href="/" rel="home">Home</a>18 17 {% for url, name in site.nav %}19 -1 <a href="{{ url }}">{{ name }}</a>-1 18 <a href="{{ url }}" {% if url == path %}class="active"{% endif %}>{{ name }}</a> 20 19 {% endfor %} 21 20 </nav> 22 21 </header>