How do I write this website?
I use Emacs for the website, the setup is pretty simple, I show how I do it here.
I have a two components, static files and pages:
(setq org-publish-project-alist `(("aziz.tn-org" :base-directory "~/emacs_site/" :base-extension "org" :publishing-directory "~/code/mohamed-aziz.github.io/" :recursive t :section-numbers nil :with-toc nil :publishing-function publish-and-sgin-html :auto-sitemap t :sitemap-filename "journal.org" :sitemap-title "Journal" :sitemap-sort-files anti-chronologically :sitemap-date-format "Published: %a %b %d %Y" :headline-levels 4 :html-preamble " <ul class=\"menu\"> <li><a href=\"https://aziz.tn/\">Home</a></li> <li><a href=\"https://aziz.tn/about.html\">About</a></li> <li><a href=\"https://aziz.tn/journal.html\">Journal</a></li> </ul>" :html-postamble " <a style=\"display:block; text-align:center; \" href='https://www.catb.org/hacker-emblem/'> <img style=\"width:auto;\" src='https://aziz.tn/static/img/glider.png' alt='hacker emblem' /></a>" :html-head-extra ,(concat "<style>" (with-temp-buffer (insert-file-contents "~/emacs_site/static/css/theme.css") (buffer-string)) "</style>")) ("aziz.tn-static" :base-directory "~/emacs_site/" :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf" :publishing-directory "~/code/mohamed-aziz.github.io/" :recursive t :publishing-function org-publish-attachment) ("aziz.tn-tangle" :base-directory "~/emacs_site/" :publishing-directory "~/emacs_site/static/files/" :recursive t :publishing-function org-babel-tangle-publish) ("aziz.tn-rss" :base-directory "~/code/mohamed-aziz.github.io/" :base-extension "org" :exclude ".*" :publishing-directory "~/public_html/" :publishing-function org-rss-publish-to-rss :include ("journal.org")) ("aziz.tn" :components ("aziz.tn-org" "aziz.tn-static" ;; "aziz.tn-rss" "aziz.tn-tangle" ))))
Then I have this wrapper over org-html-publish-to-html to sign files:
(defun publish-and-sgin-html (plist filename pub-dir) (let ((filename (org-html-publish-to-html plist filename pub-dir))) (epa-sign-file (expand-file-name filename) curr-epa-key nil)))
and the top of the cake
(defun publish-my-website () (interactive) (cond ((not (boundp 'curr-epa-key)) (setq curr-epa-key (epa-select-keys (epg-make-context) "Select keys for signing. If no one is selected, default secret key is used. " nil t)))) (org-publish "aziz.tn" t))
I also have a capture template, to capture blog posts from anywhere in Emacs:
(defun capture-report-data-file () (let ((name (read-string "Name: "))) (find-file (expand-file-name (format "%s-%s.org" (format-time-string "%Y-%m-%d") name) "~/emacs_site/blog/")))) (add-to-list 'org-capture-templates `("B" "Blog post" plain (function capture-report-data-file) "#+TITLE: %^{prompt}\n#+DATE: %T\n\n%?"))
This looks simple because it is. Having the power of Emacs and org-mode for my static website is nice I guess.
