website/publish.el
2025-04-01 13:05:13 -05:00

111 lines
3.9 KiB
EmacsLisp

(require 'package)
(add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/"))
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(package-initialize)
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(eval-and-compile
(setq use-package-always-ensure t
use-package-expand-minimally t))
(use-package org)
(use-package htmlize
:after org)
(use-package yaml-mode)
(use-package nix-mode)
(use-package plz)
(require 'org)
(require 'plz)
(defun my/org-publish-org-sitemap-format (entry style project)
(cond ((not (directory-name-p entry))
(format "(%s) [[file:blog/%s][%s]]\n"
(format-time-string "%Y-%m-%d"
(org-publish-find-date entry project))
entry
(org-publish-find-title entry project)))))
(defvar jj/html-head "\
<link rel='stylesheet' href='/css/stylesheet.css' type='text/css'/>\
<script src='/scripts/cssa-webring.js'></script>")
(defvar jj/html-preamble "\
<div class='topnav'>\
<a href='/'>Home</a>\
<a href='/projects.html'>Projects</a>\
<a href='/blog'>Blog</a>\
<a href='/dotfiles/'>Dotfiles</a>\
<a href='/about.html'>About Me</a>\
<a target='_blank' href='https://git.jjanzen.ca/jjanzen/'>Git</a>\
</div>")
(defvar jj/html-postamble "\
<footer>\
<aside id='cssa-webring-container' class='cssa-webring-container'></aside>\
<section class='copyright-notice'>copyright © jjanzen 2024-2025</section>\
<script src='/scripts/oneko.js'></script>\
</footer>")
(setq org-html-htmlize-output-type 'css)
(setq org-publish-project-alist
`(
("org-core"
:base-directory "~/website/"
:base-extension "org"
:publishing-directory "~/public_html/"
:recursive t
:publishing-function org-html-publish-to-html
:with-toc nil
:headline-levels 4
:section-numbers nil
:html-head ,jj/html-head
:html-preamble ,jj/html-preamble
:html-postamble ,jj/html-postamble)
("org-static-website"
:base-directory "~/website/"
:base-extension "txt\\|css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
:publishing-directory "~/public_html"
:recursive t
:publishing-function org-publish-attachment)
("org-blog"
:base-directory "~/blog/"
:base-extension "org"
:publishing-directory "~/public_html/blog"
:recursive t
:publishing-function org-html-publish-to-html
:with-toc nil
:with-properties t
:with-date t
:with-timestamps nil
:headline-levels 4
:section-numbers nil
:html-head ,jj/html-head
:html-preamble ,jj/html-preamble
:html-postamble ,jj/html-postamble
:auto-sitemap t
:sitemap-filename "index.org"
:sitemap-format-entry my/org-publish-org-sitemap-format
:sitemap-sort-files anti-chronologically
:sitemap-title "Blog")
("org-config"
:base-directory "~/dotfiles/"
:base-extension "org"
:html-head ,jj/html-head
:html-preamble ,jj/html-preamble
:html-postamble ,jj/html-postamble
:html-wrap-src-lines t
:with-toc nil
:section-numbers nil
:recursive t
:publishing-directory "~/public_html/dotfiles"
:publishing-function org-html-publish-to-html
:headline-levels 4
:auto-preamble t)
("org-static-config"
:base-directory "~/.dotfiles/"
:base-extension "txt\\|css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
:publishing-directory "~/public_html/dotfiles"
:recursive t
:publishing-function org-publish-attachment)
("org" :components ("org-core" "org-static-website" "org-config" "org-blog"))))
(org-publish-all t)