From 47a17508e87d979feeec396126401e0bf940fd6d Mon Sep 17 00:00:00 2001 From: Javier Olaechea Date: Fri, 15 Aug 2014 19:29:25 -0500 Subject: [PATCH] Add twitter meta-data to posts This depends on a pending change to add-injection --- plugins/twitter-summary-card.lisp | 22 ++++++++++++++++++++++ src/packages.lisp | 3 ++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 plugins/twitter-summary-card.lisp diff --git a/plugins/twitter-summary-card.lisp b/plugins/twitter-summary-card.lisp new file mode 100644 index 0000000..8a13889 --- /dev/null +++ b/plugins/twitter-summary-card.lisp @@ -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 " +~@[~] + +" + 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)) diff --git a/src/packages.lisp b/src/packages.lisp index e3c3924..93eedcd 100644 --- a/src/packages.lisp +++ b/src/packages.lisp @@ -39,4 +39,5 @@ #:purge-all #:add-document #:delete-document - #:write-document)) + #:write-document + #:content-text))