0.0
The project is in a healthy, maintained state
Makes it easy to create a new page, without adding a bunch of boiler plate manually.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

 Project Readme

Jekyll New Page Creator

This plugin provides a create-page command for Jekyll. It allows you to generate new pages or posts based on Liquid templates. When a Liquid variable is present in the template but not supplied by the context, the plugin interactively prompts the user for its value using Readline. It reduces the boilerplate required to start a new document and ensures consistency across your project.

Installation

Add this line to your application’s Gemfile inside the jekyll_plugins group:

group :jekyll_plugins do
  gem 'jekyll_new_page'
end

Then execute bundle install to download and install the gem. Alternatively, you can install it yourself by running gem install jekyll_new_page.

Usage

To create a new page using a template, run the command through Jekyll.

$ bundle exec jekyll create-page [options] <Template name>

The plugin looks for templates in the _template directory by default.

Command Line Options

-o, --output PATH

The path where the new document will be created. This argument is required.

-n, --name NAME

The name of the document. This argument is required.

--path [PATH]

A custom path to locate the template. This overrides the default _template directory.

-d, --create-subdir

Creates a subdirectory to store the new page. The resulting file is named as an index file with the proper extension.

Interactive Prompts

The core feature of this plugin is its interactive behavior. The tool parses your Liquid template before writing the final file. If it finds Liquid tags for variables that are not yet defined, it halts and asks you to provide them. This prompt is done using standard terminal input. This guarantees you never forget to fill out front matter fields like tags or categories. After the file is written, the command automatically attempts to open it using the nvim editor.

Example

Assume you have a template named post.md in your _template directory.

---
title: {{ title }}
date: {{ date }}
author: {{ author }}
---

Start writing here...

You can generate a new page with the following command.

$ bundle exec jekyll create-page -o _posts -n 2023-10-01-my-new-post post.md

The tool will parse the template. It will notice that title, date, and author are missing from the initial context. It will then prompt you in the terminal for each of these variables. You can type the values interactively. Once all variables are gathered, the plugin processes the template and creates the file in the designated output folder. Finally, it opens the new file in nvim.

Autocompletion and History

The plugin uses Readline to read user input. It also stores a history of your inputs in a hidden history file. This design allows for quick auto-completion of previously typed values. It is specially useful for recurrent fields such as authors or tags.