From: Eshel Yaron Date: Sun, 2 Apr 2023 06:32:28 +0000 (+0300) Subject: add canonical tags to all html pages X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f7a68db0ec13781dd310877d354c59deb28d4a56;p=esy-publish.git add canonical tags to all html pages --- diff --git a/publish.el b/publish.el index 63d6267..e738fe3 100644 --- a/publish.el +++ b/publish.el @@ -136,7 +136,19 @@ (with-current-buffer (find-file-noselect (expand-file-name "index.org" dir)) (org-update-all-dblocks)))) +(defun esy/publish-add-canonical-tags (_plist) + (dolist (file (directory-files-recursively esy/publish-out-directory + (rx ".html" eos))) + (with-current-buffer (find-file-noselect file) + (when (search-forward "" nil t) + (replace-match (format "" + (concat "https://eshelyaron.com/" + (file-relative-name file esy/publish-out-directory))) + nil t)) + (basic-save-buffer)))) + (defun esy/publish-completion-function (plist) + (esy/publish-add-canonical-tags plist) (esy/publish-posts plist) (esy/publish-sitemap plist)) @@ -196,10 +208,12 @@ :html-head (esy/dom-to-string '(link ((rel . "stylesheet") (href . "/style.css") (type . "text/css")))) - :html-head-extra (esy/dom-to-string '(link ((rel . "alternate") - (href . "/rss.xml") - (type . "application/rss+xml") - (title . "RSS feed of eshelyaron.com")))) + :html-head-extra (concat (esy/dom-to-string + '(link ((rel . "alternate") + (href . "/rss.xml") + (type . "application/rss+xml") + (title . "RSS feed of eshelyaron.com")))) + "\n") :html-preamble-format (list (list