Add twitter meta-data to posts
This depends on a pending change to add-injection
This commit is contained in:
parent
0640ebc5cb
commit
47a17508e8
2 changed files with 24 additions and 1 deletions
22
plugins/twitter-summary-card.lisp
Normal file
22
plugins/twitter-summary-card.lisp
Normal 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))
|
|
@ -39,4 +39,5 @@
|
|||
#:purge-all
|
||||
#:add-document
|
||||
#:delete-document
|
||||
#:write-document))
|
||||
#:write-document
|
||||
#:content-text))
|
||||
|
|
Loading…
Add table
Reference in a new issue