From c8b33e39c798c868f35131c5000b8cb1c60bba95 Mon Sep 17 00:00:00 2001 From: David Tomaschik Date: Sat, 7 Apr 2018 13:58:02 +0200 Subject: [PATCH] Avoid leading and trailing dashes in blog post slugs. --- dotfiles/zprezto_custom/jekyll/init.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotfiles/zprezto_custom/jekyll/init.zsh b/dotfiles/zprezto_custom/jekyll/init.zsh index 5cc1887..a3c68d2 100644 --- a/dotfiles/zprezto_custom/jekyll/init.zsh +++ b/dotfiles/zprezto_custom/jekyll/init.zsh @@ -73,7 +73,7 @@ function jekyll { JTEMPLATE+="category: Blog\n" JTEMPLATE+="---\n\n" TITLE=${@[2,-1]} - SLUG=$(echo -n ${TITLE}|tr A-Z a-z|tr -c -s -- a-z0-9 -) + SLUG=$(echo -n ${TITLE}|tr A-Z a-z|tr -c -s -- a-z0-9 -|sed 's/^-*\([^-].*[^-]\)-*$/\1/') DATE=`date +%Y-%m-%d` case "${1:-help}" in