File: layout.html

package info (click to toggle)
lektor 3.3.12-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 3,856 kB
  • sloc: python: 14,376; javascript: 77; makefile: 37; sh: 7; xml: 1
file content (77 lines) | stat: -rw-r--r-- 2,293 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<!doctype html>
<meta charset="utf-8">
<link rel="stylesheet" href="{{ '/static/style.css'|asseturl }}">
<link rel="stylesheet" href="{{ get_pygments_stylesheet()|url }}">
<link rel="icon" href="{{ '/static/favicon.png'|asseturl }}">
<title>{% block title %}Welcome{% endblock %} — Example</title>
<body>
  <header>
    <a href="{{ site.root|url }}" style="text-decoration: none;">
      <img class="logo" src="{{ site.root.attachments.images.get('logo.png').thumbnail(250)|url }}">
      <h1 class="logo">Example</h1>
    </a>
    <nav>
      <ul class="nav navbar-nav">
        Basic Nav:
        <li{% if this._path == '/' %} class="active"{% endif
          %}><a href="{{ '/'|url }}">Welcome</a></li>
        {% for href, title in [
          ['/blog', 'Blog'],
          ['/projects', 'Projects'],
          ['/about', 'About']
        ] %}
          <li{% if this.is_child_of(href) %} class="active"{% endif
            %}><a href="{{ href|url }}">{{ title }}</a></li>
        {% endfor %}
      </ul>
    </nav>
  </header>
  
  <div class="page">
    {% if this._path == '/' %}
      <ul>
        Available alts:
        {% for alt in get_alts() %}
          <li style="display: inline;">
            <a href="{{ '.'|url(alt=alt) }}">{{ alt }}</a>
          </li>
        {% endfor %}
      </ul>
      {{ this.alt_note }}
    {% endif %}

    {% block body %}{% endblock %}
  </div>
  <footer>
    Recursive tree navigation of this example site:
    <button onclick="myFunction()">Toggle hide/show</button>
    <ul id="footer-nav" class="tree-nav" style="display: none;">
      {% set root = site.get('/') %}
      <li>
        <a href="{{ root|url }}">{{ root.title }}</a>
      </li>
      {% for child in root.children recursive %}
        <li>
          <a href="{{ child|url }}">{{ child.path }}</a>
        </li>
        {% if child.children %}
          <ul>{{ loop(child.children) }}</ul>
        {% endif %}
      {% endfor %}
    </ul>

    <div>
      &copy; Copyright 2015 by Armin Ronacher.
    </div>
  </footer>
  <script>
    function myFunction() {
      var x = document.getElementById("footer-nav");
      if (x.style.display === "none") {
          x.style.display = "block";
      } else {
          x.style.display = "none";
      }
    }
  </script>
</body>