From b221c62a2521a240761f6ac023cdfd6b33c2a010 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Sat, 3 Sep 2022 16:07:40 +0800 Subject: org: exclude "11bus-en" from the sitemap. * org-conf.el (durand-org-publish-sitemap, durand-org-publish-sitemap-format): The article 11bus-en is an English version of the article 11bus, so the sitemap should not list the conceptually equivalent article more than once. This requires the sitemap generation to skip that article, and to delete some redundant separation markers left behind. The latter is necessary since the sitemap generator still genetates separtors for empty entries, and would mess up the format otherwise. --- org-conf.el | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/org-conf.el b/org-conf.el index c2afc19..604a3ea 100644 --- a/org-conf.el +++ b/org-conf.el @@ -804,14 +804,20 @@ project. Use such functions as `org-list-to-org' or title "#+HTML_LINK_UP: index.html" (format-time-string "%F %a %R") - (cadr (assoc title durand-sitemap-custom-string-alist #'string=)) + (cadr + (assoc title durand-sitemap-custom-string-alist #'string=)) ;; generate a table - (org-list-to-generic - rep - '(:ustart "|---|" - :uend "|---|" - :isep "|---|")) - (caddr (assoc title durand-sitemap-custom-string-alist #'string=)))) + (replace-regexp-in-string + (rx-to-string '(seq "|---|" (one-or-more space) "|---|")) + "|---|" + (org-list-to-generic + rep + '(:ustart "|---|" + :uend "|---|" + :isep "|---|"))) + (caddr + (assoc title durand-sitemap-custom-string-alist + #'string=)))) ;;;;; Custom sitemap format @@ -829,13 +835,17 @@ ENTRY is the entry file name to format. STYLE is either 'list or 'tree, which is ignored by us. PROJECT is the current project." - (format "| %s | [[file:%s][%s]] |" - (format-time-string - "%FT%T%z" - (org-publish-find-date entry project) - (current-time-zone)) - entry - (org-publish-find-title entry project))) + (cond + ;; I might want to add an "exclude-list" later if more articles + ;; require to be excluded from the sitemap file. + ((string-match-p "11bus-en" entry) "") + ((format "| %s | [[file:%s][%s]] |" + (format-time-string + "%FT%T%z" + (org-publish-find-date entry project) + (current-time-zone)) + entry + (org-publish-find-title entry project))))) ;;;; Post-processing -- cgit v1.2.3-18-g5258