diff --git a/config.org b/config.org index 7d1d2ad..b637efd 100644 --- a/config.org +++ b/config.org @@ -5931,35 +5931,41 @@ of contents as a string, or nil if it is empty." Lastly, let's pile on some metadata. This gives my pages nice embeds. #+begin_src emacs-lisp (after! ox-html - (defun org-html-meta-tags-fancy (title author info) - "Use the TITLE, AUTHOR, and INFO plist to generate info used to construct -the meta tags, as described in `org-html-meta-tags'." - (list - (when (org-string-nw-p author) - (list "name" "author" author)) - (when (org-string-nw-p (plist-get info :description)) - (list "name" "description" - (plist-get info :description))) - '("name" "generator" "org mode") - '("name" "theme-color" "#77aa99") - '("property" "og:type" "article") - (list "property" "og:title" title) - (let ((subtitle (org-export-data (plist-get info :subtitle) info))) - (when (org-string-nw-p subtitle) - (list "property" "og:description" subtitle))) - '("property" "og:image" "https://tecosaur.com/resources/org/nib.png") - '("property" "og:image:type" "image/png") - '("property" "og:image:width" "200") - '("property" "og:image:height" "200") - '("property" "og:image:alt" "Green fountain pen nib") - (when (org-string-nw-p author) - (list "property" "og:article:author:first_name" (car (s-split-up-to " " author 2)))) - (when (and (org-string-nw-p author) (s-contains-p " " author)) - (list "property" "og:article:author:last_name" (cadr (s-split-up-to " " author 2)))) - (list "property" "og:article:published_time" (format-time-string "%FT%T%z")))) + (defun org-html-meta-tags-fancy (info) + "Use the INFO plist to construct the meta tags, as described in `org-html-meta-tags'." + (let ((title (org-html-plain-text + (org-element-interpret-data (plist-get info :title)) info)) + (author (and (plist-get info :with-author) + (let ((auth (plist-get info :author))) + ;; Return raw Org syntax. + (and auth (org-html-plain-text + (org-element-interpret-data auth) info)))))) + (list + (when (org-string-nw-p author) + (list "name" "author" author)) + (when (org-string-nw-p (plist-get info :description)) + (list "name" "description" + (plist-get info :description))) + '("name" "generator" "org mode") + '("name" "theme-color" "#77aa99") + '("property" "og:type" "article") + (list "property" "og:title" title) + (let ((subtitle (org-export-data (plist-get info :subtitle) info))) + (when (org-string-nw-p subtitle) + (list "property" "og:description" subtitle))) + '("property" "og:image" "https://tecosaur.com/resources/org/nib.png") + '("property" "og:image:type" "image/png") + '("property" "og:image:width" "200") + '("property" "og:image:height" "200") + '("property" "og:image:alt" "Green fountain pen nib") + (when (org-string-nw-p author) + (list "property" "og:article:author:first_name" (car (s-split-up-to " " author 2)))) + (when (and (org-string-nw-p author) (s-contains-p " " author)) + (list "property" "og:article:author:last_name" (cadr (s-split-up-to " " author 2)))) + (list "property" "og:article:published_time" (format-time-string "%FT%T%z"))))) - (setq org-html-meta-tags-plain (bound-and-true-p org-html-meta-tags) - org-html-meta-tags #'org-html-meta-tags-fancy)) + (setq org-html-meta-tags-plain (bound-and-true-p org-html-meta-tags) + org-html-meta-tags #'org-html-meta-tags-fancy)) #+end_src ***** Custom CSS/JS The default org HTML export is ... alright, but we can really jazz it up.