Add twitter meta-data to posts

This depends on a pending change to add-injection
This commit is contained in:
Javier Olaechea 2014-08-15 19:29:25 -05:00 committed by Brit Butler
parent 0640ebc5cb
commit 47a17508e8
2 changed files with 24 additions and 1 deletions

View file

@ -0,0 +1,22 @@
(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))

View file

@ -39,4 +39,5 @@
#:purge-all
#:add-document
#:delete-document
#:write-document))
#:write-document
#:content-text))