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

eleventy-plugin-blog-tools

v0.4.1

Published

A collection of shorttags, filters and functionality to make blog posts easier

Downloads

204

Readme

Blog Tools for 11ty

This plugin is a series of shortcodes and filters that aim to help you write and organize your blog

Install instructions

Available on npm.

npm install eleventy-plugin-blog-tools --save

Open up your Eleventy config file (probably .eleventy.js) and add the plugin:

const blogTools = require("eleventy-plugin-blog-tools");
module.exports = function(eleventyConfig) {
  eleventyConfig.addPlugin(blogTools);
};

Usage

There are multiple shortcodes and filters in this plugin. Each has its own usage.

Excerpt

This custom tag creates an excerpt from a page with front matter and/or standard markdown.

Main Usage:

    {% excerpt post %}

Where post is an instance of a markdown file being pulled in via an 11ty template engine.

The Excerpt is built from one of three options:

  1. Excerpt first looks for a singular <!-- excerpt --> tag in the markdown.
  2. Then, Excerpt looks for a pair of HTML comments in your markdown specifying a start and end point for the excerpt. <!-- excerpt start --> and <!-- excerpt end --> (capitalization not important)
  3. If no start and end specified, the Excerpt tag will then look for the excerpt property in your MD file's frontmatter.
  4. If no excerpt is found in frontmatter, the tag will pull the first paragraph of the post.

YouTube

The YouTube shortcode takes a YouTube video ID and creates the markup for a fluidly-responsive YouTube embed.

{% youtube "idstring" %}

Vimeo

The Vimeo shortcode takes a Vimeo video ID and creates the markup for a fluidly-responsive Vimeo embed.

{% vimeo "idstring" %}

CodePen

The CodePen shortcode takes multiple values to customize your embed.

{% codepen "URL", "codepen tabs string", "unitlessHeight", "theme ID" %}

{% codepen "https://codepen.io/url/path" %}
{% codepen "http://codepen.io/brob/pen/vGRBeQ/", "css,result", "900", "26704"  %}

The various options have a required order (hopefully that will change in the future):

  • url: The full URL to your pen
  • tabs: String of the tabs of your codepen to display (default: "html,result")
  • height: A unitless value of the height in pixels (default: "300")
  • theme: If you have a saved theme in your Pens, you can use them with the id of the theme (default: "");

The first argument is the only required argument and it's the Pen's full URL. In Nunjucks, they need to be comma separated, in Liquid commas are optional.

Related Filter

The related filter will pull items from a list based on parameters passed to the function.

Usage

The basic usage is to filter a collection based on an array of items and a threshold.

Syntax: {{ collections.posts | related(<sort-field-key>, <sort-field-data>, <threshold-integer Defaults to 1>, <URL-to-Exclude-optional>)}}

The threshold integer is meant to force a number of array items in common. Defaults to 1.

{% for post in collections.posts | related("sortField", sortField, 1) %}
  {{ post.data.title }}
{% endfor %}