summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--haunt/post.scm5
1 files changed, 4 insertions, 1 deletions
diff --git a/haunt/post.scm b/haunt/post.scm
index 47aaa55..90a397c 100644
--- a/haunt/post.scm
+++ b/haunt/post.scm
@@ -56,10 +56,13 @@
"Return the metadata corresponding to KEY within POST."
(assq-ref (post-metadata post) key))
+(define char-set:slug
+ (char-set-union char-set:letter+digit (char-set #\-)))
+
(define (post-slug post)
"Transform the title of POST into a URL slug."
(string-join (map (lambda (s)
- (string-filter char-set:letter+digit s))
+ (string-filter char-set:slug s))
(string-split (string-downcase (post-ref post 'title))
char-set:whitespace))
"-"))