Open Graph protocol

1. generate

(defun 76/org-html-close-tag (tag &rest attrs)
  "Return close-tag for string TAG.
ATTRS specify additional attributes."
  (concat "<" tag " "
          (mapconcat (lambda (attr)
                       (format "%s=\"%s\"" (car attr) (cadr attr)))
                     attrs
                     " ")
      ">"))

(defun 76/html-head-extra (file project)
  "Return <meta> elements for nice unfurling on Twitter and Slack."
  (let* ((info (cdr project))
         (org-export-options-alist
          `((:title "TITLE" nil nil parse)
            (:date "DATE" nil nil parse)
            (:author "AUTHOR" nil ,(plist-get info :author) space)
            (:description "DESCRIPTION" nil nil newline)
            (:keywords "KEYWORDS" nil nil space)
            (:meta-image "META_IMAGE" nil ,(plist-get info :meta-image) nil)
            (:meta-type "META_TYPE" nil ,(plist-get info :meta-type) nil)))
         (title (org-publish-find-title file project))
         (date (org-publish-find-date file project))
         (author (org-publish-find-property file :author project))
         (description (org-publish-find-property file :description project))
         (link-home (file-name-as-directory (plist-get info :html-link-home)))
         (extension (or (plist-get info :html-extension) org-html-extension))
         (rel-file (org-publish-file-relative-name file info))
         (full-url (concat link-home (file-name-sans-extension rel-file) "." extension))
         (image (concat link-home (org-publish-find-property file :meta-image project)))
         (favicon (concat link-home "favicon.ico"))
         (type (org-publish-find-property file :meta-type project)))
    (mapconcat 'identity
               `(,(76/org-html-close-tag "link" '(rel icon) '(type image/x-icon) `(href ,favicon))
                 ,(76/org-html-close-tag "link" '(rel alternate) '(type application/rss+xml) '(href "rss.xml") '(title "RSS feed"))
                 ,(76/org-html-close-tag "meta" '(property og:title) `(content ,title))
                 ,(76/org-html-close-tag "meta" '(property og:url) `(content ,full-url))
                 ,(and description
                       (76/org-html-close-tag "meta" '(property og:description) `(content ,description)))
                 ,(76/org-html-close-tag "meta" '(property og:image) `(content ,image))
                 ,(76/org-html-close-tag "meta" '(property og:type) `(content ,type))
                 ,(and (equal type "article")
                       (76/org-html-close-tag "meta" '(property article:author) `(content ,author)))
                 ,(and (equal type "article")
                       (76/org-html-close-tag "meta" '(property article:published_time) `(content ,(format-time-string "%FT%T%z" date))))

                 ,(76/org-html-close-tag "meta" '(property twitter:title) `(content ,title))
                 ,(76/org-html-close-tag "meta" '(property twitter:url) `(content ,full-url))
                 ,(76/org-html-close-tag "meta" '(property twitter:image) `(content ,image))
                 ,(and description
                       (76/org-html-close-tag "meta" '(property twitter:description) `(content ,description)))
                 ,(and description
                       (76/org-html-close-tag "meta" '(property twitter:card) '(content summary)))
                 )
               "\n")))

2. Debugger

3. Ref

4. Backlinks