website/resources/html-setup.el
2025-10-19 22:00:06 -04:00

56 lines
2.2 KiB
EmacsLisp

(require 'org)
(setq org-html-style-default "")
(setq org-html-postamble
(let ((article-name (getenv "FILE_NAME"))
(last-commit (getenv "LAST_COMMIT")))
(concat
(format
"<p><a href=\"https://gitea.riouxs.co/andrew.rioux/website/src/commit/%s/%s\">View source</a></p>"
last-commit
(substring article-name 2))
(format
"<p><a href=\"/%s\">View PDF</a></p>"
(string-replace "org" "pdf" (substring article-name 2))))))
(setq org-html-head-extra
(let ((last-commit-date (getenv "LAST_COMMIT_DATE"))
(first-commit-date (getenv "FIRST_COMMIT_DATE"))
(article-name (getenv "FILE_NAME")))
(concat
"<link rel=\"stylesheet\" type=\"text/css\" href=\"/resources/basestyles.css\" />"
(format "<meta name=\"DC.date\" content=\"%s\" />" first-commit-date)
(format "<meta name=\"DC.modified\" content=\"%s\" />" last-commit-date)
"<meta name=\"DC.creator\" content=\"Andrew Rioux\" />"
"<meta name=\"DC.type\" content=\"blogPost\" />"
(format
"<meta name=\"DC.relation\" content=\"https://andrew.riouxs.co/%s\" />"
(string-replace "org" "pdf" (substring article-name 2))))))
(setq org-html-preamble
(let ((last-commit-date (getenv "LAST_COMMIT_DATE"))
(first-commit-date (getenv "FIRST_COMMIT_DATE")))
(if (string= last-commit-date first-commit-date)
(concat
"<p class=\"author\">Author: Andrew Rioux</p>"
; "<meta name=\"citation_title\" content=\"%t\" />"
"<meta name=\"DC.title\" content=\"%t\" />"
"<p class=\"date\">Publish date: "
last-commit-date
"</p>")
(concat
"<p class=\"author\">Author: Andrew Rioux</p>"
; "<meta name=\"citation_title\" content=\"%t\" />"
"<meta name=\"DC.title\" content=\"%t\" />"
"<p class=\"date\">Initial publish date: "
first-commit-date
"</p><p class=\"date\">Last modify date: "
last-commit-date
"</p>")
)))