Last active
October 20, 2021 12:41
-
-
Save miklb/53a93032fb8cc669b1fa to your computer and use it in GitHub Desktop.
A TextExpander snippet for Jekyll Front Matter. Enter a title, outputs front matter including a slug for the permalink.
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
var title = '%filltext:name=Title%'; | |
slug = title.replace(/[^\w\s]/gi, ''); | |
var newslug = title.split(" ").join("-"); | |
var dt = new Date(); | |
TextExpander.appendOutput("---\n"); | |
TextExpander.appendOutput("layout: post \n"); | |
TextExpander.appendOutput("title: " + '"' +title + '"'+ "\n"); | |
TextExpander.appendOutput("tags: \n"); | |
TextExpander.appendOutput("published: true \n"); | |
TextExpander.appendOutput("permalink: ") +TextExpander.appendOutput(newslug.toLowerCase()); + TextExpander.appendOutput(" \n"); | |
TextExpander.appendOutput("date: ") + TextExpander.appendOutput(dt.getFullYear() + "-" +(dt.getMonth() +1) + "-" + dt.getDate()) + TextExpander.appendOutput("\n"); | |
TextExpander.appendOutput("summary: \n"); | |
TextExpander.appendOutput("--- \n"); | |
// %filltop% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is really useful. Thank you so much for sharing!