about summary refs log tree commit diff
path: root/ennum.el
diff options
context:
space:
mode:
Diffstat (limited to 'ennum.el')
-rw-r--r--ennum.el32
1 files changed, 25 insertions, 7 deletions
diff --git a/ennum.el b/ennum.el
index 12e04ce..62909ba 100644
--- a/ennum.el
+++ b/ennum.el
@@ -476,12 +476,29 @@ result as a string."
   (let ((system-time-locale (map-elt (ennum-setting :locale-alist)
                                      (ennum-post-language post)))
         (ext-plist (list :ennum-post post)))
-    (ennum-with-file-contents interned-org-file
-      (cond
-       (output-html-file
-        (ennum-mkdir-p (file-name-directory output-html-file))
-        (org-export-to-file 'ennum-html output-html-file nil nil nil body-only ext-plist))
-       (t (org-export-as 'ennum-html nil nil body-only ext-plist))))))
+    (let ((org-html-meta-tags
+           `(("property" "og:title"
+              ,(ennum-post-title post))
+             ("property" "og:type"
+              "article")
+             ("property" "og:url"
+              ,(ennum--absolute-uri
+                (ennum--file-join (ennum-setting :posts-directory)
+                                  (ennum-post-slug post))))
+             ("property" "og:image"
+              ,(if (ennum-post-thumbnail post)
+                   (ennum--absolute-uri
+                    (ennum--file-join (ennum-setting :images-directory)
+                                      (ennum-image-output-filename
+                                       (ennum-post-thumbnail post)
+                                       (ennum-setting :image-thumbnail-width))))
+                 (ennum-setting :open-graph-fallback-image))))))
+      (ennum-with-file-contents interned-org-file
+        (cond
+         (output-html-file
+          (ennum-mkdir-p (file-name-directory output-html-file))
+          (org-export-to-file 'ennum-html output-html-file nil nil nil body-only ext-plist))
+         (t (org-export-as 'ennum-html nil nil body-only ext-plist)))))))
 
 (defun ennum-publish-post (post)
   (let ((interned-org-file (ennum-intern (ennum-post-filename post))))
@@ -666,7 +683,8 @@ result as a string."
   (pcase property
     ((or :blog-domain :blog-license :blog-title
          :images-directory :output-directory :posts-directory
-         :static-directory :videos-directory :working-directory)
+         :static-directory :videos-directory :working-directory
+         :open-graph-fallback-image)
      (or (plist-get ennum-blog property)
          (user-error "Property %s not defined" property)))
     ((or :atom-feed-number-of-posts :atom-feed-file