Provides tag lists and tag clouds for collections.
To load this plugin, add the following to the extras
block in your
config.php or
theme settings.php:
'extras' => [
// ...
'cms-tags' => [],
// ...
],
No configuration required
Expects tags
to be defined in the frontmatter of files.
Example:
tags: [ 'tag1', 'tag2', 'tag3' ]
or
tags:
- tag1
- tag2
- tag3
Pull the tags for a specific file
<cms-tags type="posts" file="<%= data.permalink %>"></cms-tags>
Pull the tags for all files as a weighted cloud list
<cms-tags type="posts" as="cloud"></cms-tags>
If the cms-tags
element has one of the blocks-* classes,
each tag will include a block
class to allow rendering as valid blocks.
<!-- Uses the block system to render tags as 5 equal width blocks -->
<cms-tags type="posts" limit="10" class="blocks-5"></cms-tags>
type
- The type of collection to pull tags fromfile
- The specific file to pull tags from (permalink of the file)as
- The style of tag list to render (default, cloud)sort
- The sort order to use for the tagslimit
- Limit the number of tags displayed (default is all)cms-tags:before {
content: 'ð· ';
}
cms-tags .tag-weight-1 {
font-size: 50%;
}
cms-tags .tag-weight-2 {
font-size: 60%;
}
cms-tags .tag-weight-3 {
font-size: 70%;
}
cms-tags .tag-weight-4 {
font-size: 80%;
}
cms-tags .tag-weight-5 {
font-size: 90%;
}
cms-tags .tag-weight-6 {
font-size: 100%;
}
cms-tags .tag-weight-7 {
font-size: 110%;
}
cms-tags .tag-weight-8 {
font-size: 120%;
}
cms-tags .tag-weight-9 {
font-size: 130%;
}
cms-tags .tag-weight-10 {
font-size: 140%;
}