Skip to main content

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).

Known issues

In rare cases, clicking on "Save Changes" will not replace the tags of the current page. It happens because the page is built concurrently (race condition). This affects only the currently edited page and only the inline replacements (the tags page is updated just fine). If this occurs to you, simply edit and save the page again.

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 href="/tag/{key}/">{name}</a>

[inlinetags.fields]
title = "Tagged: " ~ this.group

[inlinetags.key_map]
C# = c-sharp

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lektor-inlinetags-0.9.tar.gz (3.9 kB view hashes)

Uploaded Source

Built Distribution

lektor_inlinetags-0.9-py3-none-any.whl (4.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page