Skip to content

Instantly share code, notes, and snippets.

@kirkins
Last active July 2, 2017 04:03
Show Gist options
  • Save kirkins/385e0dd560edee52c33c64ba6ed45b1c to your computer and use it in GitHub Desktop.
Save kirkins/385e0dd560edee52c33c64ba6ed45b1c to your computer and use it in GitHub Desktop.
Vim replace DATE with date/time in Jekyll post template
# function to create a blog post, with date in name, and a timestamp
function blog() {
BLOG_DIRECTORY="/home/philip/Projects/notes/_posts/"
TEMPLATE=".template"
cp ${BLOG_DIRECTORY}${TEMPLATE} $BLOG_DIRECTORY`date +%Y-%m-%d`-$1.md
vi ${BLOG_DIRECTORY}"`date +%Y-%m-%d`"-$1.md -c ":%s/DATE/\=strftime(\"%y-%m-%d %H:%M:%S\")/g"
}
---
layout: post
title: My title
date: DATE
categories: random
short_description: My description
---
Blog text here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment