Skip to content

Commit

Permalink
[example-project] Added a recursive nav in the footer. Added some plu…
Browse files Browse the repository at this point in the history
…gin use.
  • Loading branch information
nixjdm committed Jul 10, 2018
1 parent 48cbc7d commit cdd23b8
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 12 deletions.
5 changes: 4 additions & 1 deletion example/Example.lektorproject
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ locale = fr
[alternatives.de]
name = German
url_prefix = /de/
locale = de
locale = de

[packages]
lektor-markdown-highlighter = 0.1
2 changes: 2 additions & 0 deletions example/configs/markdown-highlighter.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pygments]
style = tango
1 change: 1 addition & 0 deletions example/content/contents.lr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This is a basic demo website that shows how to use Lektor. Since this is a worki

* pages
* alternatives
* plugin use
* basic page navigation
* a blog
* blog posts
Expand Down
22 changes: 22 additions & 0 deletions example/content/plugin-use/contents.lr
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
_model: page
---
title: Plugin Use
---
body:

Here the lektor-markdown-highlighter is being used.

```python
from sys import exit

def say_hi():
print "Hello World!" # Engage in conversation

def ignore_everything():
exit(0) # Successful exit

if being_looked_at is True:
say_hi()
else:
ignore_everything()
```
33 changes: 33 additions & 0 deletions example/templates/layout.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!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>
Expand All @@ -11,6 +12,7 @@ <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 [
Expand All @@ -24,10 +26,41 @@ <h1 class="logo">Example</h1>
</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:
<ul class="tree-nav">
{% set root = site.get('/') %}
<li>
<a href="{{ root|url }}">{{ root.title }}</a>
</li>
{% for child in root.children recursive %}
{% if child.title %}
<li>
<a href="{{ child|url }}">{{ child.title }}</a>
</li>
{% endif %}
{% if child.children %}
<ul>{{ loop(child.children) }}</ul>
{% endif %}
{% endfor %}
</ul>

&copy; Copyright 2015 by Armin Ronacher.
</footer>
</body>
11 changes: 0 additions & 11 deletions example/templates/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,5 @@
{% block title %}{{ this.title }}{% endblock %}
{% block body %}
<h2>{{ this.title }}</h2>
{% 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 %}
{{ this.body }}
{% endblock %}

0 comments on commit cdd23b8

Please sign in to comment.