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-generate-posts

v0.0.5

Published

Generates batches of Eleventy posts

Downloads

3

Readme

Eleventy Generate Posts

A simple command-line utility that creates a batch of new posts for an Eleventy site.

When you're testing out some aspect of an Eleventy site or doing a demo, you often need to populate the site with a set of posts to flesh out the site. Copying a single post or set of posts repeatedly into the site works, but an automated solution is better. This is that solution.

The utility generates batches of Eleventy site posts, populating the post title with a random quantity of random words using the Rando Free Random Word Generator API and populating the post body with a random number of paragraphs of Bacon Ipsum text.

The original version of this utility used command-line arguments, but this version replaces them with prompts.

Installation

To install the command globally on the system, open a terminal window or command prompt, then execute the following command:

npm install -g eleventy-generate-posts

This adds a 11ty-gp command to the system.

You don't have to install the package to use it; simply open a terminal window or command prompt to your Eleventy project folder and execute the command using npx eleventy-generate-posts and it will execute without being installed.

Usage

Execute the command using the following command:

11ty-gp

The module will prompt you for all the required options:

┌─────────────────────────┐
│                         │
│   11ty Generate Posts   │
│                         │
└─────────────────────────┘
by John M. Wargo (https://johnwargo.com)

√ Number of posts to generate? ... 10
√ Target folder for generated posts? ... posts
√ Post tag? ... post
√ Start year for generated posts? ... 2023
√ Use year folder for posts? ... yes

Settings Summary:
----------------------------------------
Number of posts: 10
Target Folder: posts
Start Year: 2023
Tag: post
Year mode: enabled
Output folder: D:\dev\node\11ty-generate-posts\posts

Generating posts...
----------------------------------------
Writing: D:\dev\node\11ty-generate-posts\posts\2023\navigator-washbasin-dramatize-landside-sensation.md
Writing: D:\dev\node\11ty-generate-posts\posts\2023\amusing-peculiar-surgical-borough-impotency-surround-tubular.md
Writing: D:\dev\node\11ty-generate-posts\posts\2023\maturely-convene-squishier-verify.md
Writing: D:\dev\node\11ty-generate-posts\posts\2023\matchless-overlaid-expend-oxidation-tribesman.md
Writing: D:\dev\node\11ty-generate-posts\posts\2023\basis-brunt-swaddling-ladylike-support-epidemic-graded.md
Writing: D:\dev\node\11ty-generate-posts\posts\2023\certify-unsheathe-undress-obstacle-tweak-tray-ridden.md
Writing: D:\dev\node\11ty-generate-posts\posts\2023\matching-enjoying-contact-atlas.md
Writing: D:\dev\node\11ty-generate-posts\posts\2023\android-gecko-penalize-possum.md
Writing: D:\dev\node\11ty-generate-posts\posts\2023\contempt-acquire-filtrate-defense-ergonomic-acts.md
Writing: D:\dev\node\11ty-generate-posts\posts\2023\splinter-ecology-computer-nearby-shorts-feminize.md

Configuration options are:

  • Number of Posts: An integer value between 1 and 100 representing the number of posts generated.
  • Posts Folder: Relative path pointing to the Eleventy project's posts folder; use . for the current folder.
  • Post Tag: The front matter tag property applied to the generated posts
  • Start Year: The starting year used for post date in the generated posts. The command uses the current date or the current date with the specified year (when provided) to for the post date for the first generated post. For subsequent post dates, the command randomly decrements the day.
  • Use Year Folder: specifies whether the module writes generated posts to the Posts folder (N) or into a separate folder for each year (Y).

Obviously if you generate enough posts to push into the previous year, the posts will save into a folder for the previous year.

To enable debug mode, pass a -d flag on the command-line; in this mode, the module writes additional information to the console as it executes.

Add a reference to this module at the bottom of all generated posts using the -g command-line parameter. I added this feature primarily for my personal use so I can advertise the module when I use it. Here's an example of the added content:


Post content generated by Eleventy Generate Posts

Example Post

A sample generated post looks like the following:

---
title: Boaster Halogen Jokingly Evident Decode Steadfast
date: 2023-03-19
tags: post
---

Bacon ipsum dolor amet brisket picanha swine beef ribs pork.  Pig short ribs andouille ham ribeye hamburger
tail rump turducken kevin alcatra bacon beef meatloaf.  Bresaola pancetta pig, cupim frankfurter brisket 
pork belly turkey.  Pork belly frankfurter cupim, salami picanha short ribs beef ribs chuck fatback pastrami 
doner chicken ham.  Tail fatback landjaeger chicken jowl, pancetta bresaola picanha.  Pork belly ball tip 
picanha bresaola capicola prosciutto drumstick swine flank cupim corned beef.

Sausage frankfurter ground round tail, tri-tip burgdoggen flank pork loin.  Bresaola landjaeger shoulder 
pastrami burgdoggen meatball.  Frankfurter kevin pig, hamburger andouille tail meatloaf cupim meatball beef 
ribs prosciutto.  Meatloaf chislic flank tri-tip swine filet mignon brisket sirloin turkey porchetta.

Getting Help Or Making Changes

Use GitHub Issues to get help with this module.

Pull Requests gladly accepted, but only with complete documentation of what the change is, why you made it, and why you think its important to have in the module.


If this code helps you, please consider buying me a coffee.