quirks
All checks were successful
Build Org Website / build (push) Successful in 48s

This commit is contained in:
2026-05-09 23:44:17 +01:00
parent fc3962ee44
commit 4519cfe804
10 changed files with 641 additions and 4 deletions

View File

@@ -26,7 +26,8 @@
(defun z/recent-omit-org-p (rel-org)
"Return non-nil if REL-ORG (relative to site root) should be excluded."
(let ((name (file-name-nondirectory rel-org)))
(let ((name (file-name-nondirectory rel-org))
(full (expand-file-name rel-org z/site-root)))
(or
;; Static asset directories
(string-prefix-p "assets/" rel-org)
@@ -36,6 +37,8 @@
(string-match-p "/tags/" rel-org)
;; Known generated files
(member name z/recent-omit-names)
;; Deliberately discoverable only by hidden interactions.
(z/hidden-page-p full)
;; Any *-list.org sitemaps
(string-match-p "-list\\.org\\'" name))))

View File

@@ -26,6 +26,41 @@ Returns an empty string when TAGS-RAW is nil or blank."
" ")
""))
(defun z/hidden-page-p (file)
"Return non-nil when FILE opts out of public index pages."
(and (file-exists-p file)
(with-temp-buffer
(insert-file-contents file)
(org-mode)
(let ((value (cadr (assoc "HIDDEN_PAGE"
(org-collect-keywords '("HIDDEN_PAGE"))))))
(and value (string-match-p "^\\s-*t\\s-*$" (downcase value)))))))
(defun z/sitemap--link-file (link base-dir)
"Return absolute file path from Org sitemap LINK under BASE-DIR."
(when (and (stringp link)
(string-match "\\[\\[file:\\([^]]+\\)\\]" link))
(expand-file-name (match-string 1 link) base-dir)))
(defun z/sitemap--filter-hidden (node base-dir)
"Remove nodes marked with #+HIDDEN_PAGE: t from sitemap NODE."
(cond
((not (consp node)) node)
((let ((file (z/sitemap--link-file (car node) base-dir)))
(and file (z/hidden-page-p file)))
nil)
(t
(let ((children (delq nil
(mapcar (lambda (child)
(z/sitemap--filter-hidden child base-dir))
(cdr node)))))
(cons (car node) children)))))
(defun z/main-sitemap (title list)
"Default sitemap with hidden pages removed."
(org-publish-sitemap-default title
(z/sitemap--filter-hidden list z/site-root)))
(defun z/sitemap--entry-data (link base-dir)
"Extract (FULL-PATH DATE-STR TAGS-STR) for a sitemap ENTRY under BASE-DIR.
LINK is the raw [[file:...][...]] string produced by org-publish."
@@ -307,4 +342,4 @@ A file is WIP when any of the following is true:
(provide 'sitemaps)
;;; sitemaps.el ends here
;;; sitemaps.el ends here