coleslaw/plugins/twitter-summary-card.lisp
Javier Olaechea 47a17508e8 Add twitter meta-data to posts
This depends on a pending change to add-injection
2014-09-23 11:52:33 -04:00

22 lines
701 B
Common Lisp

(defpackage :coleslaw-twitter-summary-card
(:use :cl)
(: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\" />
~@[<meta property=\"twitter:author\" content=~A />~]
<meta property=\"twitter:title\" content=~A />
<meta property=\"twitter:description\" content=~A />"
twitter-handle
(title-of post)
(content-text post)))
(defun enable (&key twitter-handle)
(add-injection
(lambda (x)
(when (typep x 'post)
(summary-card x twitter-handle)))
:head))