An APA-style citation plugin for the lektor static content management system (
Go to file
Homer S. a2c8e24ffe Merge pull request 'dev0.21' (#2) from dev0.21 into master
Reviewed-on: #2
2022-01-27 22:02:13 +01:00
.gitignore Initial commit 2022-01-20 06:52:49 +01:00
LICENSE Initial commit 2022-01-20 06:52:49 +01:00 Updated the 2022-01-27 22:00:58 +01:00 Added links to cite methods. (Issue #1) 2022-01-27 21:48:23 +01:00
setup.cfg Initial commit. 2022-01-20 07:02:55 +01:00 Extended the plugin with the lektor-jinja-content plugin, too in-text citation methods and a tidied code structure. 2022-01-25 00:24:48 +01:00


An APA-styled citation plugin for the lektor static content management system (


Install the plugin by

lektor plugin add lektor-citation

or by copying this repository into the packages-folder of your lektor-project.

Create an citation.ini in its configs-folder:

file = Literature.bib

priority = url
link = /for-example/link-to-your/biblioprahy

And put a Literature.bib BibTex-file into the project's assets-folder respectively.



To get a formated output of your whole BibTex library you can either

  1. Use method citation_short_output in the template of your literature page. It creates an unordered list of entries.
  <ul id="literatur">
  {% for entry in citation_entries() %}
  {{ citation_short_output(entry)|decode|safe }}
  {% endfor %}

  1. Use method citation_full_output instead. This creates a more complete html-output for every entry.
  {% for entry in citation_entries() %}
  {{ citation_full_output(entry)|decode|safe }}
  {% endfor %}


<h2>{title}</h2><h3>{authors} ({pubYear})</h3>
<dl class="literature">
<dt class="edition"></dt>
<dt class="editors"></dt>
<dt class="pages"></dt>
<dt class="issbn"></dt>
<dt class="publisher"></dt>
  1. You may also use the citation_entry method in combination with pybtex*s Entry-class. For example:
  {% for entry in citation_entries() %}
<li>{{ citation_entry(entry).fields['title'] |decode }}</li>
  {% endfor %}

This creates an unordered list of all the titles of your bibtex file. Of course you can also use citation_entry without a loop and put any id of your bibtex entries into it as parameter.

Alternatively to the pybtex methods you can use the following jinja_env globals:


In-text Cites

To cite a certain entry in your texts you can use the jinja_env globals:

citation_full_cite(id, link="")
citation_full_citeNP(id, link="")

Both methods create a complete hyperlink inside your text for the entry with id. You may give it any url to the link parameter to e.g. link it to your bibliography page. The NP in the second stands for No Parantheses. So you'll receive e.g.

AuthorI & AuthorII (2019)


(AuthorI & AuthorII, 2019)

Which url is used for your citation's link depends on what you set in the citation.ini file.

  • If you set priority in the default section to url the link is set to the value of the url field of the entry.
  • If there's no value in it the default-link you may set with link in the same section is used.
  • If you set the link parameter of the function it overwrites the former options.

Thanks to the lektor-jinja-content plugin which is a dependency of this plugin you might also use the globals inside your markdown or html contents, too.