static_tag_cloud
'Tag cloud' rendering
To install, run nikola plugin -i static_tag_cloud
This plugin renders configurable static tag clouds. These tag clouds can also be for different taxonomies (for example categories or sections), and there can be different ones for the same taxonomy (for example a large and small variant; the large to include in the tag overview page, and the small one to include in the sidebar).
The generated HTML fragment and CSS file, one per language, must be somehow included in the rest of the blog. This can be done by using JavaScript to dynamically load the files, or by using tools like File Tree Subs.
See conf.py.sample
for an example of how to configure some tag clouds.
Suggested Configuration:
# Renders two tag clouds for tags and one for categories: # - a small one with at most 40 tags; # - a large one with all tags; # - a large one with all categories. # # The generated files are # - output/tagcloud-LANG.inc.html # - output/tagcloud-LANG-large.inc.html # - output/catcloud-LANG.inc.html # and # - output/assets/css/tagcloud-LANG-small.css # - output/assets/css/tagcloud-LANG-large.css # - output/assets/css/catcloud-LANG-large.css RENDER_STATIC_TAG_CLOUDS = { 'tag-small': { # Tag cloud's name (used as CSS class). {0} will be replaced # by the language. 'name': 'tcs-{0}', # Filename for the HTML fragment. {0} will be replaced by the # language. 'filename': 'tagcloud-{0}.inc.html', # The taxonomy type to obtain the classification ("tags") # from. 'taxonomy_type': 'tag', # Filename for the CSS. {0} will be replaced by the language. 'style_filename': 'assets/css/tagcloud-{0}-small.css', # Maximum number of levels to be generated 'max_number_of_levels': 15, # Maximum number of tags in cloud. Negative values mean # that all tags will appear. 'max_tags': 40, # Tags which appear less often than this number will be # ignored. 'minimal_number_of_appearances': 2, # Colors defining a gradient out of which the tag font colors # are taken. The colors are specified as RGP triples with each # component being a floating point number between 0.0 and 1.0. 'colors': ((0.6,0.6,0.6), (1.0,1.0,1.0)), # Colors defining a gradient out of which the tag background # colors are taken. 'background_colors': ((0.1, 0.1, 0.1), ), # Colors defining a gradient out of which the tag border colors # are taken. 'border_colors': ((0.4, 0.4, 0.4), ), # Interval (min_value, max_value) for the font size 'font_sizes': (6, 20), # If positive, will be multiplied by font size to yield the # CSS border radius and the vertical margin. (The horizontal # margin is set to zero.) 'round_factor': 0.6, }, 'tag-large': { 'name': 'tcl-{0}', 'filename': 'tagcloud-{0}-large.inc', 'taxonomy_type': 'tag', 'style_filename': 'assets/css/tagcloud-{0}-large.css', 'max_number_of_levels': 100, 'minimal_number_of_appearances': 1, 'colors': ((0.6,0.6,0.6), (1.0,1.0,1.0)), 'background_colors': ((0.1, 0.1, 0.1), ), 'border_colors': ((0.4, 0.4, 0.4), ), 'font_sizes': (8, 35), 'round_factor': 0.3, }, 'category-large': { 'name': 'ccl-{0}', 'filename': 'catcloud-{0}-large.inc', 'taxonomy_type': 'category', 'style_filename': 'assets/css/catcloud-{0}-large.css', 'max_number_of_levels': 100, 'minimal_number_of_appearances': 1, 'colors': ((0.6,0.6,0.6), (1.0,1.0,1.0)), 'background_colors': ((0.1, 0.1, 0.1), ), 'border_colors': ((0.4, 0.4, 0.4), ), 'font_sizes': (8, 35), 'round_factor': 0.3, }, }
Issues? Questions?
You can report issues with this plugin and request help via GitHub Issues.