Last active
July 2, 2017 04:03
-
-
Save kirkins/385e0dd560edee52c33c64ba6ed45b1c to your computer and use it in GitHub Desktop.
Vim replace DATE with date/time in Jekyll post template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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