Skip to main content

Tag Cloud: A Plugin for Pelican

Build Status PyPI Version License

This Pelican plugin generates a tag cloud from post tags.

Installation

This plugin can be installed via:

python -m pip install pelican-tag-cloud

For more detailed plugin installation instructions, please refer to the Pelican Plugin Documentation.

In order to use to use this plugin, you must edit your theme’s base template and style-sheet. You should change base.html to apply formats (and sizes) defined in style.css, as specified in Settings below.

Settings

Settings and their default values What does it do?
TAG_CLOUD_STEPS = 4 Count of different font sizes in the tag cloud
TAG_CLOUD_MAX_ITEMS = 100 Maximum number of tags in the cloud
TAG_CLOUD_SORTING = "random" Tag cloud ordering scheme. Valid values: random, alphabetically, alphabetically-rev, size, and size-rev
TAG_CLOUD_BADGE = True Optional setting: turn on badges, displaying the number of articles using each tag

Usage

The default theme does not include a tag cloud, but it is fairly easy to add one:

<ul class="tagcloud">
    {% for tag in tag_cloud %}
        <li class="tag-{{ tag.1 }}">
            <a href="{{ SITEURL }}/{{ tag.0.url }}">
            {{ tag.0 }}
                {% if TAG_CLOUD_BADGE %}
                    <span class="badge">{{ tag.2 }}</span>
                {% endif %}
            </a>
        </li>
    {% endfor %}
</ul>

You should then also define CSS styles with appropriate classes (tag-1 to tag-N, where N matches TAG_CLOUD_STEPS), tag-1 being the most frequent, and define a ul.tagcloud class with appropriate list-style to create the cloud. You should copy+paste this badge CSS rule ul.tagcloud .list-group-item <span>.badge if you are using the TAG_CLOUD_BADGE setting. (This rule, potentially long, is suggested to avoid conflicts with CSS frameworks such as Twitter Bootstrap.)

For example:

ul.tagcloud {
    list-style: none;
    padding: 0;
}

ul.tagcloud li {
    display: inline-block;
}

li.tag-1 {
    font-size: 150%;
}

li.tag-2 {
    font-size: 120%;
}

/* ... add li.tag-3 etc, as much as needed */

ul.tagcloud .list-group-item span.badge {
    background-color: grey;
    color: white;
}

By default, the tags in the cloud are sorted randomly, but if you prefer to have them sorted alphabetically, use alphabetically (ascending) and alphabetically-rev (descending). Also, it is possible to sort the tags by frequency (number of articles with this specific tag) using the values size (ascending) and size-rev (descending).

Contributing

Contributions are welcome and much appreciated. Every little bit helps. You can contribute by improving the documentation, adding missing features, and fixing bugs. You can also help out by reviewing and commenting on existing issues.

To start contributing to this plugin, review the Contributing to Pelican documentation, beginning with the Contributing Code section.

License

This project is licensed under the AGPL-3.0 license.

Release files for pelican-tag-cloud 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pelican-tag-cloud 1.0.1
File Size Uploaded
pelican-tag-cloud-1.0.1.tar.gz 7.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pelican-tag-cloud 1.0.1
File Interpreter ABI Platform
pelican_tag_cloud-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 13.7 kB

Release files / pelican-tag-cloud-1.0.1.tar.gz

Download URL pelican-tag-cloud-1.0.1.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
bf29107e7f2cd01f7710ed992dee7e5e67becb63c7de8a24719635d439f51f25
BLAKE2b-256 checksum
How to use checksums
40484777ee6c0cdd919fd607f15b9782f6cb91c1356ebf6dc1e547f71cf64950
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.10 CPython/3.7.12 Linux/5.8.0-1042-azure

Release files / pelican_tag_cloud-1.0.1-py3-none-any.whl

Download URL pelican_tag_cloud-1.0.1-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0dee042f01821b6142f43907d27e3041b19677483f94cc9bf3162c209dbdd834
BLAKE2b-256 checksum
How to use checksums
362daaa2a8bb3473774be0dd14616712a9397903b4e652b32d94710d820be1bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.10 CPython/3.7.12 Linux/5.8.0-1042-azure

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page