Lektor plugin to add Creative Commons license to your pages
Project description
Lektor Creative Commons
Lektor plugin to add Creative Commons license to your pages
Usage
On your templates use:
<div class="license">{{ render_cc_license(type, size, template, caller) }}</div>
type
is astring
with the license type (e.g.:'by'
,'by-sa'
,'by-nc-sa'
).size
is an optional parameter with the size'normal'
or'compact'
. It defaults to'normal'
.template
is an optional parameter with the template'full'
,'image-only'
or'text-only'
. It defaults to'full'
.caller
is an optional parameter that you can pass an callable to mount your own template. This argument is usually omitted. See the example of how to use it with the Jinja call feature.
Examples
Simply rendering the license of your choice:
<div class="license">{{ render_cc_license('by-sa') }}</div>
Using Jinja2 call block to inject your own template:
{% call(license, license_url, icon_path) render_cc_license('by-sa', size='normal') %}
<a class="nav-item" rel="license" target="_blank" href="{{ license_url }}">
<img alt="{{ license }}" style="border-width:0" src="{{ icon_path }}" />
</a>
{% endcall %}
There are more variables, you can check which with
{% call() render_cc_license('by-sa', size='normal') %}
{{ kwargs }}
{% endcall %}
Notice that using the call block it injects its content as caller
parameter to the render_cc_license
function that skips the need of choosing a template and renders your own.
Internationalization support
This plugin has support to internationalization, and changes it language based on .lektorproject
file.
The Current supported locales are:
- en
- pt_BR
- de
Any other locale will default to en
(English).
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-creative-commons-0.5.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51383ee4460c6b80188d87990c951b01ec8142e8c0ec36cec585d113cd61b22c |
|
MD5 | 73a3dc0164914415a0b994dcc6a9580a |
|
BLAKE2b-256 | d769e04298fc378e20ceedd910f9c376bf1f7b0cdbcb6e02b0237919839419d9 |
Hashes for lektor_creative_commons-0.5.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6706a64b0fa0373cca585b5e8f12ccc0794655267eb97a842fcd21ab70a4a3ca |
|
MD5 | 1b6159772f5e3925713c3ce9a88ecac8 |
|
BLAKE2b-256 | 53f6ef1249ec38ba8e6d5cc17d2f2486adf5740dceb686dcf5ffe099a4983b08 |