Socket
Book a DemoInstallSign in
Socket

gatsby-post-manager

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-post-manager

[![npm badge](https://img.shields.io/npm/v/gatsby-post-manager)](https://www.npmjs.com/package/gatsby-post-manager) [![travis badge](https://img.shields.io/travis/steven-mercatante/gatsby-post-manager)](https://travis-ci.org/steven-mercatante/gatsby-post-

latest
npmnpm
Version
0.3.0
Version published
Maintainers
1
Created
Source

Gatsby Post Manager

npm badge travis badge

Gatsby Post Manager (gpm) is a command line tool that:

  • helps keep track of Gatsby posts, and easily see which ones are published, pending, or unpublished
  • create new posts from a template

Installation

$ npm install -g gatsby-post-manager

Usage

gpm is opinionated - it assumes your posts:

  • use the .md or .mdx file extensions
  • have a required published boolean flag in their frontmatter
  • have an optional date attribute (format: YYYY-MM-DD) in their frontmatter

gpm will recursively search the provided content path (the --dir option) for posts.

Below is my example directory structure. All gpm commands are invoked from the site root.

site/
├── content/
│   ├── posts/
│   |   ├── my-first-post/
│   |   |   └── index.md
│   |   ├── my-second-post/
│   |   |   └── index.mdx
│   |   └── my-third-post.md

List all posts, including their status:

$ gpm -d content posts
# or
$ gpm -d content p

gpm-all-posts

List posts whose status is one of: published, pending, or unpublished

# status flags: --published, --pending, --unpublished
$ gpm -d content posts --pending
# or
$ gpm -d content p --pending

gpm-pending-posts

How does gpm determine post status?

  • A post's status is published if its published attribute is true, and its date attribute occurs before or is equal to today's date (if the post has a date attribute)
  • A post's status is pending if its published attribute is true, and its date attribute occurs after today's date (if the post has a date attribute)
  • A post's status is published if its published attribute is true, and it does not have a date attribute
  • A post's status is unpublished if its published attribute is not true, or doesn't have a published attribute at all

Display post stats:

$ gpm -d content post-stats
# or
$ gpm -d content ps

gpm-all-posts

Create a post:

$ gpm posts new path/to/posts "hello world"

will create a new path/to/posts/hello-world.md file whose frontmatter looks like:

---
title: Hello World
slug: "hello-world"
tags: []
published: false
date: "2019-09-23"
---
Add your content here

Keywords

gatsby

FAQs

Package last updated on 24 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.