Flexible Lisp Blogware. Fork for personal use. Mirrored from https://github.com/kingcons/coleslaw originally.

twitter-summary-card.lisp 701B

1234567891011121314151617181920212223
  1. (defpackage :coleslaw-twitter-summary-card
  2. (:use :cl)
  3. (:export #:enable))
  4. (in-package :coleslaw-twitter-summary-card)
  5. (defun summary-card (post twitter-handle)
  6. "TODO: Figure if and how to include twitter:url meta property."
  7. (format nil "<meta property=\"twitter:card\" content=\"summary\" />
  8. ~@[<meta property=\"twitter:author\" content=~A />~]
  9. <meta property=\"twitter:title\" content=~A />
  10. <meta property=\"twitter:description\" content=~A />"
  11. twitter-handle
  12. (title-of post)
  13. (content-text post)))
  14. (defun enable (&key twitter-handle)
  15. (add-injection
  16. (lambda (x)
  17. (when (typep x 'post)
  18. (summary-card x twitter-handle)))
  19. :head))