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

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.2.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

lektor_inlinetags-0.9.2-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file lektor-inlinetags-0.9.2.tar.gz.

File metadata

  • Download URL: lektor-inlinetags-0.9.2.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.2

File hashes

Hashes for lektor-inlinetags-0.9.2.tar.gz
Algorithm Hash digest
SHA256 72fda54f1febd2298ca600893bcfabc33c1d9b5702b31e5ae81b7b3723b3702d
MD5 b5bd134bbee88d5cd8784032145e858d
BLAKE2b-256 1b062607eb935836d17c17bedd99102b2f4a7d44dca721c189103757324f2ac0

See more details on using hashes here.

File details

Details for the file lektor_inlinetags-0.9.2-py3-none-any.whl.

File metadata

File hashes

Hashes for lektor_inlinetags-0.9.2-py3-none-any.whl
Algorithm Hash digest
SHA256 db910fe527093a9f778e899d422a50ef8ac323f78ad8ae51c8fce2984a262e20
MD5 1c2b4fb0cdea584f0176de37d7ddc568
BLAKE2b-256 69ddcd69a17ef908060225e019b3a302baf0851621363c5627887637f49a298a

See more details on using hashes here.

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