Auto-detect and reference tags inside written text.
Project description
lektor plugin: inlinetags
The inlinetags plugin allows you to use tags inside normal text / html / markdown elements.
For example, you can write This is my {{Lektor}} powered website
and it will automatically replace the tag with a link to the actual page: This is my <a href="/tag/lektor/">Lektor</a> powered website
.
Of course, you can configure a different matching pattern, e.g., instead of the default {{tag}}
use $tag$
(\$(.{1,20}?)\$
).
This plugin is based on the lektor-groupby plugin.
All configuration options from groupby can be used (including multiple attribute names).
Further, you can access the tags of a page with the filter |vgroups(key1, key2, recursive=False)
where key is 0..N
attribute keys.
If no key is provided, all attributes will be returned – otherwise only matching attribute keys.
Example config file
Add a new inlinetags = True
attribute to your model, e.g., a flow block:
[block]
name = Text Element
button_label = [[paragraph]]
[fields.content]
label = Text
type = markdown
inlinetags = True
In your plugin config (configs/inlinetags.ini
):
[inlinetags]
root = /
slug = "tag/{}/index.html".format(this.key)
template = tag-page.html
[inlinetags.pattern]
match = {{([^}]{1,32})}}
replace = <a class="tag" href="/tag/{key}/">{name}</a>
[inlinetags.fields]
title = "Tagged: " ~ this.group
[inlinetags.key_map]
C# = c-sharp
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for lektor_inlinetags-0.9.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d7766591e0f5b9f6d1cbd29fa0ca2830915c8e083a9651cc51b4cea3a0bac03 |
|
MD5 | 4ea1c3162a26158ba56ee2146e8ef7b8 |
|
BLAKE2b-256 | 7226adf4cd418b1b261da7d318719bb119053eb2046089c7a9e02c61828d5fea |