2014-08-15 19:29:25 -05:00
|
|
|
(defpackage :coleslaw-twitter-summary-card
|
2014-08-15 20:18:40 -05:00
|
|
|
(:use :cl :coleslaw)
|
2014-08-15 19:29:25 -05:00
|
|
|
(:export #:enable))
|
|
|
|
|
|
|
|
(in-package :coleslaw-twitter-summary-card)
|
|
|
|
|
|
|
|
(defun summary-card (post twitter-handle)
|
|
|
|
"TODO: Figure if and how to include twitter:url meta property."
|
|
|
|
(format nil "<meta property=\"twitter:card\" content=\"summary\" />
|
2014-08-15 20:18:40 -05:00
|
|
|
~@[<meta property=\"twitter:author\" content=\"~A\" />~]
|
|
|
|
<meta property=\"twitter:title\" content=\"~A\" />
|
|
|
|
<meta property=\"twitter:description\" content=\"~A\" />"
|
2014-08-15 19:29:25 -05:00
|
|
|
twitter-handle
|
|
|
|
(title-of post)
|
2014-08-15 20:18:40 -05:00
|
|
|
(let ((text (content-text post)))
|
|
|
|
(if (< 200 (length text))
|
|
|
|
(subseq text 0 199)
|
|
|
|
text))))
|
2014-08-15 19:29:25 -05:00
|
|
|
|
|
|
|
(defun enable (&key twitter-handle)
|
|
|
|
(add-injection
|
|
|
|
(lambda (x)
|
|
|
|
(when (typep x 'post)
|
|
|
|
(summary-card x twitter-handle)))
|
|
|
|
:head))
|