Code Monkey home page Code Monkey logo

eleventy-plugin-blog-tools's Introduction

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.

YouTube

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

{% youtube "idstring" %}

Vimeo

The YouTube 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 %}

eleventy-plugin-blog-tools's People

Contributors

brob avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.