npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

docpad-plugin-tagcloud

v2.0.1

Published

DocPad plugin providing tag cloud generation

Downloads

9

Readme

TagCloud Plugin for DocPad

Extends DocPad's tagging features by adding tag cloud generation

Install

npm install --save docpad-plugin-tagcloud

Usage

This plugin supercedes the now deprecated Tagging plugin for Docpad >= 6.46. It works in conjunction with the new Tags plugin.

Generate tag index pages for your documents as described in the Tags plugin.

The plugin adds the @getTagCloud() template helper, which returns an object containing the tag cloud data of the form:

yellow:
	tag: "yellow"			// the tag name
	url: "/tags/yellow"		// URL of the tag index page
	count: 5					// number of documents containing the tag
	weight: 0.25				// weight of the tag
blue:
	tag: "blue"
	url: "/tags/blue"
	count: 3
	weight: 0.12
...

The following example iterates through the tag cloud and generates links to the tag index pages (in eco):

<% for tag, data of @getTagCloud(): %>
    <a href="<%= data.url %>" data-tag-count="<%= data.count %>" data-tag-weight="<%= data.weight %>">
        <%= tag %>
    </a>
<% end %>

Note that in this example we've added the count and weight here as HTML5 data fields so that a client-side script can apply the desired styling. You can of course do whatever you wish with the count or weight values, such as adding inline CSS for setting the font-size (but of course we don't do that kind of thing anymore right?)

Options

  • collectionName : The collection containing your tag index pages. This should probably be the same as specified for the tags plugin.
  • getTagWeight : Override the function used to generate the tag weights (see below).
  • logLevel: Override the log level for log messages from this plugin. Defaults to 'info'.

Customising the weight function

By default, the tag weights are calculated using a simple logarithmic algorithm. If that isn't floating your proverbial boat you are free to override this function with the weight function of your choosing. For example in your docpad config you could add:

plugins:
    tagging:
        getTagWeight: (count, maxCount) ->
            return count/maxCount

Here count is the number of occurences of the tag, and maxCount is the count of the tag with the highest number of occurrences.

History

You can discover the history inside the History.md file

License

Licensed under the incredibly permissive MIT License Copyright © 2013 Richard Antecki