docs: add example project
This commit is contained in:
5
example/Example.lektorproject
Normal file
5
example/Example.lektorproject
Normal file
@@ -0,0 +1,5 @@
|
||||
[project]
|
||||
name = Inlinetags Example
|
||||
|
||||
[packages]
|
||||
lektor-inlinetags = 0.9.2
|
||||
7
example/Makefile
Normal file
7
example/Makefile
Normal file
@@ -0,0 +1,7 @@
|
||||
.PHONY: server clean plugins
|
||||
server:
|
||||
lektor server
|
||||
clean:
|
||||
lektor clean --yes -v
|
||||
plugins:
|
||||
lektor plugins flush-cache && lektor plugins list
|
||||
23
example/configs/inlinetags.ini
Normal file
23
example/configs/inlinetags.ini
Normal file
@@ -0,0 +1,23 @@
|
||||
[inlinetags]
|
||||
root = /
|
||||
slug = tag/{key}/
|
||||
template = tag-page.html
|
||||
|
||||
[inlinetags.pattern]
|
||||
match = {{([^}]{1,32})}}
|
||||
replace = <a class="tag" href="{url}">{name}</a>
|
||||
|
||||
[inlinetags.fields]
|
||||
title = "Tagged: " ~ this.key_obj
|
||||
|
||||
[inlinetags.key_map]
|
||||
C# = c-sharp
|
||||
|
||||
|
||||
[inlinetags_hidden]
|
||||
slug = hidden-tag/{key}/
|
||||
template = tag-page.html
|
||||
|
||||
[inlinetags_hidden.pattern]
|
||||
match = {{([^}]{1,32})}}
|
||||
replace = {name}
|
||||
3
example/content/contents.lr
Normal file
3
example/content/contents.lr
Normal file
@@ -0,0 +1,3 @@
|
||||
title: Use Inlinetags in {{title}}!
|
||||
---
|
||||
body: This is a {{demo}} {{demo}} website that shows how to use {{Lektor}} with inline {{tags}}. Test {{C#}}.
|
||||
13
example/models/page.ini
Normal file
13
example/models/page.ini
Normal file
@@ -0,0 +1,13 @@
|
||||
[model]
|
||||
name = Page
|
||||
label = {{ this.title }}
|
||||
|
||||
[fields.title]
|
||||
label = Title
|
||||
type = string
|
||||
inlinetags_hidden = true
|
||||
|
||||
[fields.body]
|
||||
label = Body
|
||||
type = markdown
|
||||
inlinetags = true
|
||||
21
example/templates/page.html
Normal file
21
example/templates/page.html
Normal file
@@ -0,0 +1,21 @@
|
||||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>Inlinetags</title>
|
||||
<style type="text/css">
|
||||
main { margin: 1em; }
|
||||
footer { padding: 1em; background: #DDD; }
|
||||
</style>
|
||||
<body>
|
||||
<main>
|
||||
{# Using "|safe" to allow clickable links in title #}
|
||||
<h2>{{ this.title|safe }}</h2>
|
||||
{% block body %}{{ this.body }}{% endblock %}
|
||||
</main>
|
||||
<footer>
|
||||
<a href="/">Root</a>,
|
||||
Tags:
|
||||
{%- for x in this|vgroups(recursive=True, order_by='key_obj') %}
|
||||
<a href="{{ x|url }}"><{{x.key_obj}}></a>
|
||||
{%- endfor %}
|
||||
</footer>
|
||||
</body>
|
||||
10
example/templates/tag-page.html
Normal file
10
example/templates/tag-page.html
Normal file
@@ -0,0 +1,10 @@
|
||||
{% extends "page.html" %}
|
||||
{% block body %}
|
||||
<p>Key: <b>{{this.key}}</b> | Object: <b>{{this.key_obj}}</b></p>
|
||||
Page with <b>{{this.children.count()}}</b> tag(s):
|
||||
<ul>
|
||||
{%- for child in this.children|unique %}
|
||||
<li><a href="{{child|url}}">{{child.title}}</a></li>
|
||||
{%- endfor %}
|
||||
</ul>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user