Skip to content

Instantly share code, notes, and snippets.

@miklb
Last active October 20, 2021 12:41
Show Gist options
  • Select an option

  • Save miklb/53a93032fb8cc669b1fa to your computer and use it in GitHub Desktop.

Select an option

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.
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%
@catherinepope

Copy link
Copy Markdown

This is really useful. Thank you so much for sharing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment