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

@codegouvfr/eleventy-plugin-calendar

v3.0.6

Published

A plugin for generating an ICS calendar and events.

Downloads

248

Readme

Node.js workflow

eleventy-plugin-calendar

Eleventy plugin containing filters for generating ICS calendar and ICS events using the Nunjucks templating engine.

Motivations

Turn your posts directly into events that will show up in a published ICS calendar, or that you can import into another calendar!

Installation

npm install @codegouvfr/eleventy-plugin-calendar 

Open up your Eleventy config file (probably eleventy.config.js) and use addPlugin:

const calendarPlugin = require("@codegouvfr/eleventy-plugin-calendar");

module.exports = eleventyConfig => {
    eleventyConfig.addPlugin(calendarPlugin);
};

You're now supplied with the following filters:

  • slugifyEvent: slugify event name and date. Useful for setting calendar event permalink.
  • toCalendar: turn a collection into an ICS calendar.
  • toCalendarEvent: turn an event into an ICS event.

Options

const calendarPlugin = require("@codegouvfr/eleventy-plugin-calendar");

module.exports = eleventyConfig => {
    eleventyConfig.addPlugin(calendarPlugin, {
        defaultLocation: "online",
        defaultOrganizer: {
            name: "hjonin",
            email: "[email protected]"
        }
    });
};

Usage

See sample/calendar.njk for an example ICS calendar template and sample/calendar-event.njk for an example ICS event template.

Copy and paste these templates and modify the YAML frontmatter to match your calendar’s needs. Make sure collections.events (the collection of post files using the events tag) matches the template collection you want to provide a calendar and calendar events for.

Place the files anywhere in your project and they will be transformed into a calendar.ics and calendar/{eventName-eventDate}.ics file at the root of your website (or depending on your calendar and events permalinks if you've changed them) when Eleventy builds it.

Ultimately your calendar will be available at https://yourwebsite.com/calendar.ics.

See sample/event-all-day/index.md and sample/event-with-time/index.md for example events. Event variables are:

{
  "title": "string",
  "description": "string",
  "start": "date",
  "end": "date",
  "duration": {
    "days": "number",
    "hours": "number",
    "minutes": "number"
  },
  "location": "string",
  "organizer": {
    "name": "string",
    "email": "string"
  }
}

Notes on dates

Dates must be of ISO 8601 format, see here for full examples, or below:

2016-05-25
2016-05-25T09:24

Either end or duration is required, but not both. However, if both are provided, end prevails on duration.

If start has not time or no end is provided, the event is considered "all-day".

Run the example:

npm run sample
[npm run clean]

Development and testing

Install dependencies:

npm install

Test:

npm test

Publishing

npm version [version]
npm publish