fixing gitignore
This commit is contained in:
27
home/backlog.org
Normal file
27
home/backlog.org
Normal file
@@ -0,0 +1,27 @@
|
||||
#+TITLE: Backlog
|
||||
#+OPTIONS: num:nil toc:nil
|
||||
#+DATE: <2025-11-08 Sat 11:08>
|
||||
#+FILETAGS: :emacs:website:
|
||||
#+NO_SIDENOTES: t
|
||||
#+COMMENTS: t
|
||||
#+SLUG: backlog
|
||||
|
||||
|
||||
* TODO
|
||||
|
||||
* DOING
|
||||
|
||||
* DONE
|
||||
|
||||
- Add a notes page <2025-12-18 Thu>
|
||||
- Add a *move* function in the competencies board page for mobile <2025-12-18 Thu>
|
||||
- Refactor the build script to extract functions into seperate files <2025-12-16 Tue>
|
||||
- Add a WIP property in an org file. If the header contains the string "WIP" then create a list of all WIP items and add to it. Otherwise do nothing.
|
||||
- Page for latest updated files.
|
||||
- Give lima extra controls, and update the syntax file for her.
|
||||
- Service for RDP
|
||||
- Create the backlog page.
|
||||
|
||||
* For another time
|
||||
|
||||
- Instead of deleting the output directory each time the website is built, only delete the files that have been changed.
|
||||
25
home/backlog.org~
Normal file
25
home/backlog.org~
Normal file
@@ -0,0 +1,25 @@
|
||||
#+TITLE: Backlog
|
||||
#+OPTIONS: num:nil toc:nil
|
||||
#+DATE: <2025-11-08 Sat 11:08>
|
||||
#+FILETAGS: :emacs:website:
|
||||
#+COMMENTS: t
|
||||
#+SLUG: backlog
|
||||
|
||||
* TODO
|
||||
|
||||
* DOING
|
||||
|
||||
* DONE
|
||||
|
||||
- Refactor the build script to extract functions into seperate files <2025-12-16 Tue>
|
||||
- Add a WIP property in an org file. If the header contains the string "WIP" then create a list of all WIP items and add to it. Otherwise do nothing.
|
||||
- Page for latest updated files.
|
||||
- Give lima extra controls, and update the syntax file for her.
|
||||
- Service for RDP
|
||||
- Create the backlog page.
|
||||
|
||||
* For another time :(
|
||||
|
||||
- Instead of deleting the output directory each time the website is built, only delete the files that have been changed.
|
||||
- Remove lima's files from the sitemap (for some odd reason).
|
||||
|
||||
14
home/categories.org
Normal file
14
home/categories.org
Normal file
@@ -0,0 +1,14 @@
|
||||
#+TITLE: Categories
|
||||
#+OPTIONS: toc:nil num:nil title:nil
|
||||
|
||||
* Categories (Includes both blogs and posts)
|
||||
- [[file:tags/education.org][@@html:<span class="post-tag">education</span>@@]] (1)
|
||||
- [[file:tags/emacs.org][@@html:<span class="post-tag">emacs</span>@@]] (2)
|
||||
- [[file:tags/insights.org][@@html:<span class="post-tag">insights</span>@@]] (4)
|
||||
- [[file:tags/introduction.org][@@html:<span class="post-tag">introduction</span>@@]] (3)
|
||||
- [[file:tags/learning.org][@@html:<span class="post-tag">learning</span>@@]] (10)
|
||||
- [[file:tags/maths.org][@@html:<span class="post-tag">maths</span>@@]] (1)
|
||||
- [[file:tags/notes.org][@@html:<span class="post-tag">notes</span>@@]] (11)
|
||||
- [[file:tags/reading.org][@@html:<span class="post-tag">reading</span>@@]] (1)
|
||||
- [[file:tags/review.org][@@html:<span class="post-tag">review</span>@@]] (9)
|
||||
- [[file:tags/website.org][@@html:<span class="post-tag">website</span>@@]] (2)
|
||||
16
home/contact.org
Normal file
16
home/contact.org
Normal file
@@ -0,0 +1,16 @@
|
||||
#+TITLE: Contact
|
||||
#+OPTIONS: toc:nil num:nil
|
||||
|
||||
* Contact Using the Following:
|
||||
|
||||
> LinkedIn: *[[https://www.linkedin.com/in/zaine-ul-abideen-qayyum-801a53247/][LinkedIn]]*
|
||||
|
||||
> GitHub: *[[https://github.com/zainezq][Github]]*
|
||||
|
||||
> Email:
|
||||
|
||||
- *zaineulabideen (at) outlook (dot) com*
|
||||
|
||||
- [[mailto:zaineulabideen@outlook.com][zaineulabideen@outlook.com]]
|
||||
|
||||
Thanks for visiting!
|
||||
14
home/countdown.org
Normal file
14
home/countdown.org
Normal file
@@ -0,0 +1,14 @@
|
||||
#+TITLE: Countdown
|
||||
#+OPTIONS: num:nil title:nil
|
||||
#+DATE: <2025-08-04 Mon>
|
||||
#+COMMENTS: t
|
||||
#+SLUG: wedding-countdown
|
||||
|
||||
* zaine and halima :)
|
||||
|
||||
|
||||
#+ATTR_HTML: :class countdown-wrap
|
||||
{{{countdown(2026-08-02T00:00:00Z,Nikah Day)}}}
|
||||
|
||||
#+ATTR_HTML: :class countdown-wrap
|
||||
{{{countdown(2026-08-09T00:00:00Z,Walima Day)}}}
|
||||
12
home/countdown.org~
Normal file
12
home/countdown.org~
Normal file
@@ -0,0 +1,12 @@
|
||||
#+TITLE: Countdown
|
||||
#+OPTIONS: num:nil title:nil
|
||||
#+DATE: <2025-08-04 Mon>
|
||||
|
||||
* zaine and halima :)
|
||||
|
||||
|
||||
#+ATTR_HTML: :class countdown-wrap
|
||||
{{{countdown(2026-08-02T00:00:00Z,Nikah Day)}}}
|
||||
|
||||
#+ATTR_HTML: :class countdown-wrap
|
||||
{{{countdown(2026-08-09T00:00:00Z,Walima Day)}}}
|
||||
34
home/notes.org
Normal file
34
home/notes.org
Normal file
@@ -0,0 +1,34 @@
|
||||
#+TITLE: Notes
|
||||
#+OPTIONS: toc:nil num:nil
|
||||
#+NO_SIDENOTES: t
|
||||
#+COMMENTS: t
|
||||
#+SLUG: notes
|
||||
|
||||
#+BEGIN_EXPORT html
|
||||
<div id="notes-wall">
|
||||
<p>Loading notes…</p>
|
||||
</div>
|
||||
|
||||
<div id="notes-form-wrapper">
|
||||
<form id="notes-form">
|
||||
<label for="note-author">Name (required)</label>
|
||||
<input
|
||||
id="note-author"
|
||||
name="author_name"
|
||||
type="text"
|
||||
maxlength="100"
|
||||
required
|
||||
/>
|
||||
|
||||
<label for="note-content">Note</label>
|
||||
<textarea
|
||||
id="note-content"
|
||||
name="content"
|
||||
rows="4"
|
||||
required
|
||||
></textarea>
|
||||
|
||||
<button type="submit">Post note</button>
|
||||
</form>
|
||||
</div>
|
||||
#+END_EXPORT
|
||||
38
home/notes.org~
Normal file
38
home/notes.org~
Normal file
@@ -0,0 +1,38 @@
|
||||
#+TITLE: Public Notes
|
||||
#+OPTIONS: toc:nil num:nil
|
||||
#+NO_SIDENOTES: t
|
||||
#+COMMENTS: t
|
||||
#+SLUG: notes
|
||||
|
||||
|
||||
This page is a shared notes space — short thoughts, marginalia, and passing ideas.
|
||||
Names are required; everything else is intentionally lightweight.
|
||||
|
||||
#+BEGIN_EXPORT html
|
||||
<div id="notes-wall">
|
||||
<p>Loading notes…</p>
|
||||
</div>
|
||||
|
||||
<div id="notes-form-wrapper">
|
||||
<form id="notes-form">
|
||||
<label for="note-author">Name</label>
|
||||
<input
|
||||
id="note-author"
|
||||
name="author_name"
|
||||
type="text"
|
||||
maxlength="100"
|
||||
required
|
||||
/>
|
||||
|
||||
<label for="note-content">Note</label>
|
||||
<textarea
|
||||
id="note-content"
|
||||
name="content"
|
||||
rows="4"
|
||||
required
|
||||
></textarea>
|
||||
|
||||
<button type="submit">Post note</button>
|
||||
</form>
|
||||
</div>
|
||||
#+END_EXPORT
|
||||
24
home/services.org
Normal file
24
home/services.org
Normal file
@@ -0,0 +1,24 @@
|
||||
#+TITLE: Service
|
||||
#+OPTIONS: toc:nil num:nil title:nil
|
||||
#+COMMENTS: t
|
||||
#+SLUG: services
|
||||
|
||||
|
||||
| Service | Link |
|
||||
|---------------+--------------|
|
||||
| PgAdmin | [[https://pgadmin.zainezq.com/][PgAdmin]] |
|
||||
| Stirling PDF | [[https://stirlingpdf.zainezq.com/][Stirling PDF]] |
|
||||
| Portainer | [[https://portainer.zainezq.com/][Portainer]] |
|
||||
| File Browser | [[https://filebrowser.zainezq.com/][File Browser]] |
|
||||
| Calibre Web | [[https://calibre.zainezq.com/][Calibre Web]] |
|
||||
| Miniflux | [[https://miniflux.zainezq.com/][Miniflux]] |
|
||||
| JupyterLab | [[https://jupyter.zainezq.com/][JupyterLab]] |
|
||||
| Guacamole | [[https://guac.zainezq.com/][Guacamole]] |
|
||||
| Vaultwarden | [[https://bitwarden.zainezq.com/][Vaultwarden]] |
|
||||
| Reader | [[https://reader.zainezq.com/][Reader]] |
|
||||
| Netdata | [[https://netdata.zainezq.com/][Netdata]] |
|
||||
| Books VNC | [[https://booksvnc.zainezq.com/][Books VNC]] |
|
||||
| Actual | [[https://actual.zainezq.com/][Actual]] |
|
||||
| Photo Library | [[https://photo.zainezq.com/][Immich]] |
|
||||
| VPN | [[https://wgeasy.zainezq.com/][wg-easy]] |
|
||||
| Glance | [[https://glance.zainezq.com/][Glance]] |
|
||||
21
home/services.org~
Normal file
21
home/services.org~
Normal file
@@ -0,0 +1,21 @@
|
||||
#+TITLE: Service
|
||||
#+OPTIONS: toc:nil num:nil title:nil
|
||||
|
||||
| Service | Link |
|
||||
|---------------+--------------|
|
||||
| PgAdmin | [[https://pgadmin.zainezq.com/][PgAdmin]] |
|
||||
| Stirling PDF | [[https://stirlingpdf.zainezq.com/][Stirling PDF]] |
|
||||
| Portainer | [[https://portainer.zainezq.com/][Portainer]] |
|
||||
| File Browser | [[https://filebrowser.zainezq.com/][File Browser]] |
|
||||
| Calibre Web | [[https://calibre.zainezq.com/][Calibre Web]] |
|
||||
| Miniflux | [[https://miniflux.zainezq.com/][Miniflux]] |
|
||||
| JupyterLab | [[https://jupyter.zainezq.com/][JupyterLab]] |
|
||||
| Guacamole | [[https://guac.zainezq.com/][Guacamole]] |
|
||||
| Vaultwarden | [[https://bitwarden.zainezq.com/][Vaultwarden]] |
|
||||
| Reader | [[https://reader.zainezq.com/][Reader]] |
|
||||
| Netdata | [[https://netdata.zainezq.com/][Netdata]] |
|
||||
| Books VNC | [[https://booksvnc.zainezq.com/][Books VNC]] |
|
||||
| Actual | [[https://actual.zainezq.com/][Actual]] |
|
||||
| Photo Library | [[https://photo.zainezq.com/][Immich]] |
|
||||
| VPN | [[https://wgeasy.zainezq.com/][wg-easy]] |
|
||||
| Glance | [[https://glance.zainezq.com/][Glance]] |
|
||||
444
home/setup.org
Normal file
444
home/setup.org
Normal file
@@ -0,0 +1,444 @@
|
||||
#+TITLE: Setup
|
||||
#+OPTIONS: toc:nil num:nil
|
||||
#+COMMENTS: t
|
||||
#+SLUG: setup
|
||||
#+NO_SIDENOTES: t
|
||||
|
||||
* Introduction
|
||||
|
||||
/Last updated: <2025-12-18 Thu 22:00>/
|
||||
|
||||
See this link[fn:1] for a more generic introduction on how to publish websites using ~org-publish~.
|
||||
|
||||
This page will highlight the ~build-script.el~ used to generate this website. This entire website is generated through org files using the command:
|
||||
|
||||
#+BEGIN_SRC bash
|
||||
emacs -Q --script build-site.el
|
||||
#+END_SRC
|
||||
|
||||
* The script
|
||||
|
||||
The script is as follows, at the start I have some metadata relating to the file, followed by package management,then the declaration of variables/functions and finally the ~org-publish-project-alist~ which handles nearly all of the project generation instructions.
|
||||
|
||||
/The following code snippet will probably change often, as I can never seem to stick to a single configuration 😀/
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
;;; build-site.el --- Publish my website using org-publish -*- lexical-binding: t; -*-
|
||||
|
||||
;; Author: Zaine Qayyum <zaineulabideen@outlook.com>
|
||||
;; Created: 2025-08-08
|
||||
;; Purpose: Build and publish my static site from Org files.
|
||||
|
||||
;;; Commentary:
|
||||
;; Run this file with:
|
||||
;; emacs -Q --script build-site.el
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'package)
|
||||
|
||||
(add-to-list 'load-path "~/master-folder/org_files/org_web/lisp/")
|
||||
|
||||
(require 'recently-updated)
|
||||
(require 'tags)
|
||||
(require 'sidenotes)
|
||||
(require 'sitemaps)
|
||||
|
||||
(setq package-user-dir (expand-file-name "./.packages"))
|
||||
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
|
||||
("elpa" . "https://elpa.gnu.org/packages/")))
|
||||
|
||||
(require 'ox-publish)
|
||||
(require 'cl-lib)
|
||||
(require 'org)
|
||||
(require 'ox)
|
||||
(require 'ox-html)
|
||||
|
||||
(package-initialize)
|
||||
(unless package-archive-contents
|
||||
(package-refresh-contents))
|
||||
|
||||
(package-install 'htmlize)
|
||||
(add-to-list 'load-path "~/master-folder/org_files/org_web/")
|
||||
(require 'htmlize)
|
||||
|
||||
(defvar z-shared-head
|
||||
"
|
||||
<link rel=\"stylesheet\" href=\"/assets/styles/style.css\" />
|
||||
<link rel=\"stylesheet\" href=\"/assets/styles/bigger-picture.min.css\" />
|
||||
<link rel=\"stylesheet\" href=\"/assets/styles/comments.css\" />
|
||||
<link rel=\"stylesheet\" href=\"/assets/styles/kanban.css\" />
|
||||
<link rel=\"stylesheet\" href=\"/assets/styles/org-syntax.css\" />
|
||||
<link rel=\"stylesheet\" href=\"/assets/styles/misc.css\" />
|
||||
<link rel=\"stylesheet\" href=\"/assets/styles/toc.css\" />
|
||||
<link rel=\"stylesheet\" href=\"/assets/styles/media.css\" />
|
||||
|
||||
<script src=\"/assets/scripts/script.js\" defer></script>
|
||||
<script src=\"/assets/scripts/competency-status-board.js\" defer></script>
|
||||
<script src=\"/assets/scripts/comments.js\" defer></script>
|
||||
<script src=\"/assets/scripts/bigger-picture.min.js\" defer></script>
|
||||
<script src=\"/assets/scripts/svg-pan-zoom.min.js\" defer></script>
|
||||
<script src=\"/assets/scripts/gallery-init.js\" defer></script>
|
||||
"
|
||||
)
|
||||
|
||||
(setq org-export-global-macros
|
||||
(append
|
||||
'(("sidenote"
|
||||
. "@@html:<label for=\"sn$1\" class=\"margin-toggle sidenote-number\"></label><input type=\"checkbox\" id=\"sn$1\" class=\"margin-toggle\"/><span class=\"sidenote\">$2</span>@@")
|
||||
("epigraph" . "@@html:<div class=\"epigraph\"><blockquote>$1<footer>$2</footer></blockquote></div>@@")
|
||||
("epigraph_single" . "@@html:<div class=\"epigraph\"><blockquote>$1</blockquote></div>@@")
|
||||
("epigraph3" . "@@html:<div class=\"epigraph\"><blockquote>$1<footer>$2, <cite>$3</cite></footer></blockquote></div>@@")
|
||||
("kbd" . "@@html:<kbd>$1</kbd>@@@@latex:\\texttt{$1}@@")
|
||||
("margimg"
|
||||
. "@@html:<aside class=\"marginnote\"><figure class=\"mn-fig\"><img src=\"$1\" alt=\"$2\" class=\"mn-img\" loading=\"lazy\" decoding=\"async\"/>$3</figure></aside>@@")
|
||||
("countdown" . "@@html:<time class=\"countdown\" datetime=\"$1\" data-label=\"$2\"></time>@@")
|
||||
|
||||
|
||||
org-export-global-macros)))
|
||||
|
||||
|
||||
(defvar z-preamble
|
||||
"
|
||||
<div class=\"banner-header\">
|
||||
<a href=\"/\"> <img src=\"/assets/images/gr.png\" alt=\"Site Logo\" class=\"banner-logo\" /> </a>
|
||||
<nav>
|
||||
<a href=\"/\">Home | </a>
|
||||
<a href=\"/blogs/2025/2025-list.html \">2025 | </a>
|
||||
<a href=\"/blogs/blogs-list.html\">Blogs | </a>
|
||||
<a href=\"/posts/career/career-list.html\">Career | </a>
|
||||
<a href=\"/home/services.html\">Services</a>
|
||||
</nav>
|
||||
<button class=\"theme-toggle\" id=\"theme-toggle\" type=\"button\" aria-label=\"Toggle dark mode\">🌗 Theme</button>
|
||||
</div>
|
||||
<div id=\"updated\">Updated: %C</div>
|
||||
|
||||
"
|
||||
)
|
||||
|
||||
(defvar z-postamble
|
||||
"<footer>
|
||||
<div class=\"copyright-container\">
|
||||
<div class=\"copyright\">
|
||||
Copyright © 2022-2025 Zaine Qayyum. All rights reserved unless otherwise noted.</div></div>
|
||||
<div class=\"generated\">
|
||||
Created with %c on <a href=\"https://www.archlinux.org/\">Arch</a> <a href=\"https://www.gnu.org\">GNU</a>/<a href=\"https://www.kernel.org/\">Linux</a>
|
||||
</div>
|
||||
</footer>")
|
||||
|
||||
|
||||
|
||||
(defun z/comments-file-p (file)
|
||||
"Return non-nil if FILE has comments enabled.
|
||||
A file has comments if:
|
||||
- It has a #+COMMENTS: keyword with value \"t\" (case-insensitive)."
|
||||
(when (file-exists-p file)
|
||||
(with-temp-buffer
|
||||
(insert-file-contents file)
|
||||
(org-mode)
|
||||
(let* ((keywords (org-collect-keywords '("COMMENTS")))
|
||||
(comments (cadr (assoc "COMMENTS" keywords))))
|
||||
(and comments
|
||||
(string-match-p "^\\s-*t\\s-*$"
|
||||
(downcase comments)))))))
|
||||
|
||||
(defun z/comments-file-slug (file)
|
||||
"Return page slug from #+SLUG: or fallback to filename."
|
||||
(with-temp-buffer
|
||||
(insert-file-contents file)
|
||||
(org-mode)
|
||||
(let* ((keywords (org-collect-keywords '("SLUG")))
|
||||
(slug (cadr (assoc "SLUG" keywords))))
|
||||
(if (and slug (string-match-p "\\S-" slug))
|
||||
slug
|
||||
(file-name-base file)))))
|
||||
|
||||
(defun z/org-html-insert-comments-into-body (body backend info)
|
||||
"Insert comments section at the end of the document body."
|
||||
(when (org-export-derived-backend-p backend 'html)
|
||||
(let ((input-file (plist-get info :input-file)))
|
||||
(if (and input-file
|
||||
(z/comments-file-p input-file))
|
||||
(let* ((slug (z/comments-file-slug input-file))
|
||||
(comments-html
|
||||
(format
|
||||
"
|
||||
<section id=\"comments\" class=\"comments\" data-slug=\"%s\">
|
||||
<h2>Comments</h2>
|
||||
|
||||
<div id=\"comments-list\" class=\"comments-list\">
|
||||
<noscript>Please enable JavaScript to view comments.</noscript>
|
||||
</div>
|
||||
|
||||
<form id=\"comment-form\" class=\"comment-form\">
|
||||
<label class=\"comment-author\">
|
||||
<span>Name (optional)</span>
|
||||
<input type=\"text\" name=\"author\"/>
|
||||
</label>
|
||||
|
||||
<label class=\"comment-content\">
|
||||
<span>Your comment</span>
|
||||
<textarea name=\"content\" required></textarea>
|
||||
</label>
|
||||
|
||||
<button type=\"submit\">Post comment</button>
|
||||
</form>
|
||||
</section>
|
||||
"
|
||||
slug)))
|
||||
(concat body comments-html))
|
||||
body))))
|
||||
|
||||
|
||||
(defun z/org-html-add-body-classes (output backend info)
|
||||
"Add layout-related classes to <body> based on file metadata."
|
||||
(when (org-export-derived-backend-p backend 'html)
|
||||
(let* ((input-file (plist-get info :input-file))
|
||||
(classes
|
||||
(delq nil
|
||||
(list
|
||||
(when (and input-file
|
||||
(z/wip-file-p input-file))
|
||||
"wip")
|
||||
(when (and input-file
|
||||
(z/no-sidenotes-file-p input-file))
|
||||
"no-sidenotes")))))
|
||||
(if classes
|
||||
(replace-regexp-in-string
|
||||
"<body\\([^>]*\\)>"
|
||||
(format "<body\\1 class=\"%s\">"
|
||||
(string-join classes " "))
|
||||
output)
|
||||
output))))
|
||||
|
||||
(add-to-list 'org-export-filter-final-output-functions
|
||||
#'z/org-html-add-body-classes)
|
||||
(add-to-list 'org-export-filter-body-functions
|
||||
#'z/org-html-insert-comments-into-body)
|
||||
|
||||
|
||||
|
||||
(setq org-html-htmlize-output-type 'css)
|
||||
|
||||
(org-export-define-derived-backend 'z-html 'html
|
||||
:filters-alist '((:filter-final-output . z/insert-filetags-after-title)))
|
||||
|
||||
(defun z/org-main-prep (_project)
|
||||
(z/generate-recently-updated-org 26))
|
||||
|
||||
(defun z/z-publish-to-html (plist filename pub-dir)
|
||||
"Publish FILENAME to HTML using the z-html backend."
|
||||
(org-publish-org-to 'z-html filename ".html" plist pub-dir))
|
||||
|
||||
;; Define the publishing project
|
||||
(setq org-publish-project-alist
|
||||
`(("org-main"
|
||||
:recursive t
|
||||
:base-directory "~/master-folder/org_files/org_web/"
|
||||
:publishing-function z/z-publish-to-html
|
||||
:publishing-directory "~/master-folder/org_files/org_web/output"
|
||||
:base-extension "org"
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "sitemap.org"
|
||||
:sitemap-title "Sitemap"
|
||||
:sitemap-sort-files chronologically
|
||||
:html-preamble ,z-preamble
|
||||
:html-postamble ,z-postamble
|
||||
:html-head ,z-shared-head
|
||||
:preparation-function z/org-main-prep
|
||||
)
|
||||
|
||||
("org-categories-sitemap"
|
||||
:recursive t
|
||||
:base-directory "~/master-folder/org_files/org_web/home"
|
||||
:publishing-directory "~/master-folder/org_files/org_web/output/home"
|
||||
:base-extension "org"
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "categories.org"
|
||||
:sitemap-title "Categories"
|
||||
:sitemap-function z/categories-sitemap
|
||||
:html-preamble ,z-preamble
|
||||
:html-postamble ,z-postamble
|
||||
:html-head ,z-shared-head
|
||||
)
|
||||
("org-posts"
|
||||
:base-directory "~/master-folder/org_files/org_web/posts"
|
||||
:publishing-directory "~/master-folder/org_files/org_web/output/posts/"
|
||||
:recursive t
|
||||
:base-extension "org"
|
||||
:publishing-function z/z-publish-to-html
|
||||
:with-author nil
|
||||
:with-creator nil
|
||||
:html-validation-link nil
|
||||
:with-toc t
|
||||
:section-numbers t
|
||||
:html-preamble ,z-preamble
|
||||
:html-postamble ,z-postamble
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "posts-list.org"
|
||||
:sitemap-title "Posts List"
|
||||
:sitemap-style list
|
||||
:sitemap-function z/posts-sitemap
|
||||
:sitemap-sort-files anti-chronologically
|
||||
:html-head ,z-shared-head
|
||||
)
|
||||
("org-blogs"
|
||||
:base-directory "~/master-folder/org_files/org_web/blogs"
|
||||
:publishing-directory "~/master-folder/org_files/org_web/output/blogs/"
|
||||
:recursive t
|
||||
:base-extension "org"
|
||||
:publishing-function z/z-publish-to-html
|
||||
:with-author nil
|
||||
:with-creator nil
|
||||
:html-validation-link nil
|
||||
:html-preamble ,z-preamble
|
||||
:html-postamble ,z-postamble
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "blogs-list.org"
|
||||
:sitemap-title "Blogs List"
|
||||
:sitemap-style list
|
||||
:sitemap-function z/blogs-sitemap
|
||||
:sitemap-sort-files anti-chronologically
|
||||
:html-head ,z-shared-head
|
||||
)
|
||||
("org-books"
|
||||
:base-directory "~/master-folder/org_files/org_web/books/"
|
||||
:publishing-directory "~/master-folder/org_files/org_web/output/books/"
|
||||
:recursive t
|
||||
:base-extension "org"
|
||||
:publishing-function z/z-publish-to-html
|
||||
:with-author nil
|
||||
:with-creator nil
|
||||
:html-validation-link nil
|
||||
:html-preamble ,z-preamble
|
||||
:html-postamble ,z-postamble
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "books-list.org"
|
||||
:sitemap-title "Books List"
|
||||
:sitemap-style list
|
||||
:sitemap-function z/books-sitemap
|
||||
:sitemap-sort-files anti-chronologically
|
||||
:html-head ,z-shared-head
|
||||
)
|
||||
("org-2025"
|
||||
:base-directory "~/master-folder/org_files/org_web/blogs/2025/"
|
||||
:publishing-directory "~/master-folder/org_files/org_web/output/blogs/2025/"
|
||||
:recursive t
|
||||
:base-extension "org"
|
||||
:publishing-function z/z-publish-to-html
|
||||
:with-author nil
|
||||
:with-creator nil
|
||||
:html-validation-link nil
|
||||
:html-preamble ,z-preamble
|
||||
:html-postamble ,z-postamble
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "2025-list.org"
|
||||
:sitemap-title "2025 List"
|
||||
:sitemap-style list
|
||||
:sitemap-function z/2025-sitemap
|
||||
:sitemap-sort-files anti-chronologically
|
||||
:html-head ,z-shared-head
|
||||
)
|
||||
("org-career"
|
||||
:base-directory "~/master-folder/org_files/org_web/posts/career/"
|
||||
:publishing-directory "~/master-folder/org_files/org_web/output/posts/career/"
|
||||
:recursive t
|
||||
:base-extension "org"
|
||||
:publishing-function z/z-publish-to-html
|
||||
:with-author nil
|
||||
:with-creator nil
|
||||
:html-validation-link nil
|
||||
:html-preamble ,z-preamble
|
||||
:html-postamble ,z-postamble
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "career-list.org"
|
||||
:sitemap-title "Career List"
|
||||
:sitemap-style list
|
||||
:sitemap-function z/career-sitemap
|
||||
:sitemap-sort-files anti-chronologically
|
||||
:html-head ,z-shared-head
|
||||
)
|
||||
("wip-pages"
|
||||
:base-directory "~/master-folder/org_files/org_web/"
|
||||
:publishing-directory "~/master-folder/org_files/org_web/output/"
|
||||
:recursive t
|
||||
:base-extension "org"
|
||||
:publishing-function z/z-publish-to-html
|
||||
:with-author nil
|
||||
:with-creator nil
|
||||
:html-validation-link nil
|
||||
:html-preamble ,z-preamble
|
||||
:html-postamble ,z-postamble
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "wip.org"
|
||||
:sitemap-title "Work in progress"
|
||||
:sitemap-style list
|
||||
:sitemap-function z/wip-sitemap
|
||||
:sitemap-sort-files anti-chronologically
|
||||
:html-head ,z-shared-head
|
||||
)
|
||||
("org-tags"
|
||||
:base-directory "~/master-folder/org_files/org_web/tags"
|
||||
:publishing-directory "~/master-folder/org_files/org_web/output/tags"
|
||||
:recursive t
|
||||
:base-extension "org"
|
||||
:publishing-function org-html-publish-to-html
|
||||
:with-author nil
|
||||
:with-creator nil
|
||||
:html-preamble ,z-preamble
|
||||
:html-postamble ,z-postamble
|
||||
:html-head ,z-shared-head)
|
||||
("org-assets"
|
||||
:base-directory "~/master-folder/org_files/org_web/assets/"
|
||||
:base-extension "css\\|js\\|png\\|jpg\\|gif\\|svg\\|pdf\\|woff\\|woff2\\|ttf"
|
||||
:publishing-directory "~/master-folder/org_files/org_web/output/assets/"
|
||||
:recursive t
|
||||
:publishing-function org-publish-attachment)
|
||||
))
|
||||
|
||||
|
||||
(delete-directory "~/master-folder/org_files/org_web/output/" t)
|
||||
(delete-directory "~/master-folder/org_files/org_web/tags/" t)
|
||||
(message "Directory deleted")
|
||||
|
||||
(z/write-tag-pages)
|
||||
(org-publish-all t)
|
||||
(message "Build complete!")
|
||||
|
||||
;;; build-site.el ends here
|
||||
#+END_SRC
|
||||
|
||||
* Publish Script
|
||||
/Note: This is legacy, just keeping it here for logs/
|
||||
|
||||
As the project is hosted on Github, I have created a small script that is able to push changes to the remote repository, which Cloudflare will automatically detect and rebuild the website:
|
||||
|
||||
#+BEGIN_SRC bash
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
# Exit immediately if any command fails
|
||||
set -e
|
||||
|
||||
# Define paths
|
||||
ORG_OUTPUT_DIR="$HOME/master-folder/org_files/org_web/output"
|
||||
|
||||
cd "$ORG_OUTPUT_DIR"
|
||||
|
||||
echo "HTML published to: $ORG_OUTPUT_DIR"
|
||||
|
||||
# Git commands
|
||||
echo "Adding changes to Git..."
|
||||
git add .
|
||||
|
||||
echo "Committing..."
|
||||
git commit -m "Auto-publish on $(date)" || echo "Nothing to commit."
|
||||
|
||||
echo "Pushing to GitHub..."
|
||||
git push origin main
|
||||
|
||||
echo "Done! Changes pushed and Cloudflare should rebuild the site."
|
||||
|
||||
#+END_SRC
|
||||
|
||||
[fn:1] See: [[../blogs/publish-pages.org][this link]]
|
||||
684
home/setup.org~
Normal file
684
home/setup.org~
Normal file
@@ -0,0 +1,684 @@
|
||||
#+TITLE: Setup
|
||||
#+OPTIONS: toc:nil num:nil
|
||||
#+COMMENTS: t
|
||||
#+SLUG: setup
|
||||
|
||||
* Introduction
|
||||
|
||||
/Last updated: <2025-11-06 Thu 21:16>/
|
||||
|
||||
See this link[fn:1] for a more generic introduction on how to publish websites using ~org-publish~.
|
||||
|
||||
This page will highlight the ~build-script.el~ used to generate this website. This entire website is generated through org files using the command:
|
||||
|
||||
#+BEGIN_SRC bash
|
||||
emacs -Q --script build-site.el
|
||||
#+END_SRC
|
||||
|
||||
* The script
|
||||
|
||||
The script is as follows, at the start I have some metadata relating to the file, followed by package management,then the declaration of variables/functions and finally the ~org-publish-project-alist~ which handles nearly all of the project generation instructions.
|
||||
|
||||
/The following code snippet will probably change often, as I can never seem to stick to a single configuration 😀/
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
;;; build-site.el --- Publish my website using org-publish -*- lexical-binding: t; -*-
|
||||
|
||||
;; Author: Zaine Qayyum <zaineulabideen@outlook.com>
|
||||
;; Created: 2025-08-08
|
||||
;; Purpose: Build and publish my static site from Org files.
|
||||
|
||||
;;; Commentary:
|
||||
;; Run this file with:
|
||||
;; emacs -Q --script build-site.el
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'package)
|
||||
(setq package-user-dir (expand-file-name "./.packages"))
|
||||
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
|
||||
("elpa" . "https://elpa.gnu.org/packages/")))
|
||||
|
||||
(require 'ox-publish)
|
||||
(require 'cl-lib)
|
||||
(require 'org)
|
||||
(require 'ox)
|
||||
(require 'ox-html)
|
||||
|
||||
;; Initialize the package system
|
||||
(package-initialize)
|
||||
(unless package-archive-contents
|
||||
(package-refresh-contents))
|
||||
|
||||
;; Install dependencies
|
||||
(package-install 'htmlize)
|
||||
(add-to-list 'load-path "~/master-folder/org_files/org_web/")
|
||||
(require 'htmlize)
|
||||
|
||||
(setq org-html-htmlize-output-type 'css)
|
||||
|
||||
(defvar z-shared-head
|
||||
"
|
||||
<link rel=\"stylesheet\" href=\"/assets/styles/style.css\" />
|
||||
<link rel=\"stylesheet\" href=\"/assets/styles/bigger-picture.min.css\" />
|
||||
|
||||
<script src=\"/assets/scripts/script.js\" defer></script>
|
||||
<script src=\"/assets/scripts/bigger-picture.min.js\" defer></script>
|
||||
<script src=\"/assets/scripts/svg-pan-zoom.min.js\" defer></script>
|
||||
<script src=\"/assets/scripts/gallery-init.js\" defer></script>
|
||||
"
|
||||
)
|
||||
|
||||
(setq org-export-global-macros
|
||||
(append
|
||||
'(("sidenote"
|
||||
. "@@html:<label for=\"sn$1\" class=\"margin-toggle sidenote-number\"></label><input type=\"checkbox\" id=\"sn$1\" class=\"margin-toggle\"/><span class=\"sidenote\">$2</span>@@")
|
||||
("epigraph" . "@@html:<div class=\"epigraph\"><blockquote>$1<footer>$2</footer></blockquote></div>@@")
|
||||
("epigraph_single" . "@@html:<div class=\"epigraph\"><blockquote>$1</blockquote></div>@@")
|
||||
("epigraph3" . "@@html:<div class=\"epigraph\"><blockquote>$1<footer>$2, <cite>$3</cite></footer></blockquote></div>@@")
|
||||
("kbd" . "@@html:<kbd>$1</kbd>@@@@latex:\\texttt{$1}@@")
|
||||
("margimg"
|
||||
. "@@html:<aside class=\"marginnote\"><figure class=\"mn-fig\"><img src=\"$1\" alt=\"$2\" class=\"mn-img\" loading=\"lazy\" decoding=\"async\"/>$3</figure></aside>@@")
|
||||
("countdown" . "@@html:<time class=\"countdown\" datetime=\"$1\" data-label=\"$2\"></time>@@")
|
||||
|
||||
|
||||
org-export-global-macros)))
|
||||
|
||||
|
||||
(defvar z-preamble
|
||||
"
|
||||
<div class=\"banner-header\">
|
||||
<a href=\"/\"> <img src=\"/assets/images/gr.png\" alt=\"Site Logo\" class=\"banner-logo\" /> </a>
|
||||
<nav>
|
||||
<a href=\"/\">Home | </a>
|
||||
<a href=\"/posts/posts-list.html\">Posts | </a>
|
||||
<a href=\"/blogs/blogs-list.html\">Blogs | </a>
|
||||
<a href=\"/contact.html\">Contact | </a>
|
||||
<a href=\"/services.html\">Services</a>
|
||||
</nav>
|
||||
<button class=\"theme-toggle\" id=\"theme-toggle\" type=\"button\" aria-label=\"Toggle dark mode\">🌗 Theme</button>
|
||||
</div>
|
||||
<div id=\"updated\">Updated: %C</div>
|
||||
|
||||
"
|
||||
)
|
||||
|
||||
(defvar z-postamble
|
||||
"<footer>
|
||||
<div class=\"copyright-container\">
|
||||
<div class=\"copyright\">
|
||||
Copyright © 2022-2025 Zaine Qayyum. All rights reserved unless otherwise noted.</div></div>
|
||||
<div class=\"generated\">
|
||||
Created with %c on <a href=\"https://www.archlinux.org/\">Arch</a> <a href=\"https://www.gnu.org\">GNU</a>/<a href=\"https://www.kernel.org/\">Linux</a>
|
||||
</div>
|
||||
</footer>")
|
||||
|
||||
|
||||
(defun z/posts-sitemap (title list)
|
||||
"sitemap that lists post links as bullet points with dates and tags."
|
||||
(concat
|
||||
"#+TITLE: " title "\n"
|
||||
"#+OPTIONS: toc:nil num:nil \n\n"
|
||||
"See the categories: @@html:<a href=\"../categories.html\">Categories</a>@@\n\n"
|
||||
"* Posts:\n"
|
||||
(mapconcat
|
||||
(lambda (entry)
|
||||
(let* ((link (car entry))
|
||||
;; extract relative file name from the link
|
||||
(filename (if (string-match "\\[\\[file:\\([^]]+\\)\\]" link)
|
||||
(match-string 1 link)
|
||||
link))
|
||||
(full-path (expand-file-name filename "~/master-folder/org_files/org_web/posts/"))
|
||||
(date-str "no date")
|
||||
(tags-str ""))
|
||||
;; Get publish date
|
||||
(let ((date (org-publish-find-date full-path org-publish-project-alist)))
|
||||
(when date
|
||||
(setq date-str (format-time-string "%d-%m-%Y %H:%M" date))))
|
||||
;; Get FILETAGS from file buffer
|
||||
(when (file-exists-p full-path)
|
||||
(with-temp-buffer
|
||||
(insert-file-contents full-path)
|
||||
(org-mode)
|
||||
(let* ((tags (cadr (assoc "FILETAGS" (org-collect-keywords '("FILETAGS"))))))
|
||||
(when tags
|
||||
(setq tags-str (mapconcat (lambda (tag)
|
||||
(format "@@html:<a href=\"/tags/%s.html\"> <span class=\"post-tag\">%s</span> </a>@@" tag tag))
|
||||
(split-string tags ":" t) ;; <- Splits by ":" and removes empty strings
|
||||
" "))))))
|
||||
;; Final line output
|
||||
(format "- %s @@html:<span class=\"post-date\">%s</span>@@ %s" link date-str tags-str)))
|
||||
(cdr list)
|
||||
"\n")))
|
||||
|
||||
|
||||
(defun z/blogs-sitemap (title list)
|
||||
"sitemap that lists blog links as bullet points with dates and tags."
|
||||
(concat
|
||||
"#+TITLE: " title "\n"
|
||||
"#+OPTIONS: toc:nil num:nil \n\n"
|
||||
"See the categories: @@html:<a href=\"../categories.html\">Categories</a>@@\n\n"
|
||||
"* Blogs:\n"
|
||||
(mapconcat
|
||||
(lambda (entry)
|
||||
(let* ((link (car entry))
|
||||
;; extract relative file name from the link
|
||||
(filename (if (string-match "\\[\\[file:\\([^]]+\\)\\]" link)
|
||||
(match-string 1 link)
|
||||
link))
|
||||
(full-path (expand-file-name filename "~/master-folder/org_files/org_web/blogs/"))
|
||||
(date-str "no date")
|
||||
(tags-str ""))
|
||||
;; Get publish date
|
||||
(let ((date (org-publish-find-date full-path org-publish-project-alist)))
|
||||
(when date
|
||||
(setq date-str (format-time-string "%d-%m-%Y %H:%M" date))))
|
||||
;; Get FILETAGS from file buffer
|
||||
(when (file-exists-p full-path)
|
||||
(with-temp-buffer
|
||||
(insert-file-contents full-path)
|
||||
(org-mode)
|
||||
(let* ((tags (cadr (assoc "FILETAGS" (org-collect-keywords '("FILETAGS"))))))
|
||||
(when tags
|
||||
(setq tags-str (mapconcat (lambda (tag)
|
||||
(format "@@html:<a href=\"/tags/%s.html\"> <span class=\"post-tag\">%s</span> </a>@@" tag tag))
|
||||
(split-string tags ":" t) ;; <- Splits by ":" and removes empty strings
|
||||
" "))))))
|
||||
;; Final line output
|
||||
(format "- %s @@html:<span class=\"post-date\">%s</span>@@ %s" link date-str tags-str)))
|
||||
(cdr list)
|
||||
"\n")))
|
||||
|
||||
|
||||
(defun z/books-sitemap (title list)
|
||||
"sitemap that lists books."
|
||||
(concat
|
||||
"#+TITLE: " title "\n"
|
||||
"#+OPTIONS: toc:nil num:nil \n\n"
|
||||
"See the categories: @@html:<a href=\"../categories.html\">Categories</a>@@\n\n"
|
||||
"* Book Notes:\n"
|
||||
(mapconcat
|
||||
(lambda (entry)
|
||||
(let* ((link (car entry))
|
||||
;; extract relative file name from the link
|
||||
(filename (if (string-match "\\[\\[file:\\([^]]+\\)\\]" link)
|
||||
(match-string 1 link)
|
||||
link))
|
||||
(full-path (expand-file-name filename "~/master-folder/org_files/org_web/books/"))
|
||||
(date-str "no date")
|
||||
(tags-str ""))
|
||||
;; Get publish date
|
||||
(let ((date (org-publish-find-date full-path org-publish-project-alist)))
|
||||
(when date
|
||||
(setq date-str (format-time-string "%d-%m-%Y %H:%M" date))))
|
||||
;; Get FILETAGS from file buffer
|
||||
(when (file-exists-p full-path)
|
||||
(with-temp-buffer
|
||||
(insert-file-contents full-path)
|
||||
(org-mode)
|
||||
(let* ((tags (cadr (assoc "FILETAGS" (org-collect-keywords '("FILETAGS"))))))
|
||||
(when tags
|
||||
(setq tags-str (mapconcat (lambda (tag)
|
||||
(format "@@html:<a href=\"/tags/%s.html\"> <span class=\"post-tag\">%s</span> </a>@@" tag tag))
|
||||
(split-string tags ":" t) ;; <- Splits by ":" and removes empty strings
|
||||
" "))))))
|
||||
;; Final line output
|
||||
(format "- %s @@html:<span class=\"post-date\">%s</span>@@ %s" link date-str tags-str)))
|
||||
(cdr list)
|
||||
"\n")))
|
||||
|
||||
(defun z/2025-sitemap (title list)
|
||||
"Sitemap that lists 2025 posts grouped by month, with dates and FILETAGS."
|
||||
(let ((output (concat
|
||||
"#+TITLE: " title "\n"
|
||||
"#+OPTIONS: toc:nil num:nil \n\n"
|
||||
"See the categories: @@html:<a href=\"../../categories.html\">Categories</a>@@\n\n"
|
||||
"* 2025\n"))
|
||||
(current-month nil))
|
||||
|
||||
;; `list` is what org-publish passes in; we skip its car (top-level title node)
|
||||
(dolist (entry (cdr list))
|
||||
;; In this setup each ENTRY is usually (LINK . OTHER-STUFF)
|
||||
(when (consp entry)
|
||||
(let* ((link (car entry))
|
||||
;; Extract relative filename from the [[file:...][...]] link
|
||||
(filename (if (string-match "\\[\\[file:\\([^]]+\\)\\]" link)
|
||||
(match-string 1 link)
|
||||
link))
|
||||
(full-path (expand-file-name
|
||||
filename
|
||||
"~/master-folder/org_files/org_web/blogs/2025/"))
|
||||
(date (when (file-exists-p full-path)
|
||||
(org-publish-find-date full-path org-publish-project-alist)))
|
||||
(date-str (if date
|
||||
(format-time-string "%d-%m-%Y %H:%M" date)
|
||||
"no date"))
|
||||
(month-str (if date
|
||||
(format-time-string "%B %Y" date) ; e.g. "August 2025"
|
||||
"No date"))
|
||||
(tags-str ""))
|
||||
|
||||
;; Collect FILETAGS from the file
|
||||
(when (file-exists-p full-path)
|
||||
(with-temp-buffer
|
||||
(insert-file-contents full-path)
|
||||
(org-mode)
|
||||
(let ((tags (cadr (assoc "FILETAGS"
|
||||
(org-collect-keywords '("FILETAGS"))))))
|
||||
(when tags
|
||||
(setq tags-str
|
||||
(mapconcat
|
||||
(lambda (tag)
|
||||
(format "@@html:<a href=\"/tags/%s.html\"> \
|
||||
<span class=\"post-tag\">%s</span> </a>@@" tag tag))
|
||||
(split-string tags ":" t)
|
||||
" "))))))
|
||||
|
||||
;; Insert month heading whenever month changes
|
||||
(unless (equal month-str current-month)
|
||||
(setq current-month month-str)
|
||||
(setq output (concat output "\n** " month-str "\n")))
|
||||
|
||||
;; Insert the actual entry
|
||||
(setq output
|
||||
(concat output
|
||||
(format "- %s @@html:<span class=\"post-date\">%s</span>@@ %s\n"
|
||||
link date-str tags-str))))))
|
||||
|
||||
output))
|
||||
|
||||
(defun z/career-sitemap (title list)
|
||||
"Sitemap that lists careers posts grouped by month, with dates and FILETAGS."
|
||||
(let ((output (concat
|
||||
"#+TITLE: " title "\n"
|
||||
"#+OPTIONS: toc:nil num:nil \n\n"
|
||||
"See the categories: @@html:<a href=\"../../categories.html\">Categories</a>@@\n\n"
|
||||
"* 2025\n"
|
||||
"See the following page for more details: @@html:<a href=\"./career-intro.html\">Career Intro</a>@@\n"
|
||||
))
|
||||
(current-month nil))
|
||||
|
||||
;; `list` is what org-publish passes in; we skip its car (top-level title node)
|
||||
(dolist (entry (cdr list))
|
||||
;; In this setup each ENTRY is usually (LINK . OTHER-STUFF)
|
||||
(when (consp entry)
|
||||
(let* ((link (car entry))
|
||||
;; Extract relative filename from the [[file:...][...]] link
|
||||
(filename (if (string-match "\\[\\[file:\\([^]]+\\)\\]" link)
|
||||
(match-string 1 link)
|
||||
link))
|
||||
(full-path (expand-file-name
|
||||
filename
|
||||
"~/master-folder/org_files/org_web/posts/career/"))
|
||||
(date (when (file-exists-p full-path)
|
||||
(org-publish-find-date full-path org-publish-project-alist)))
|
||||
(date-str (if date
|
||||
(format-time-string "%d-%m-%Y %H:%M" date)
|
||||
"no date"))
|
||||
(month-str (if date
|
||||
(format-time-string "%B %Y" date) ; e.g. "August 2025"
|
||||
"No date"))
|
||||
(tags-str ""))
|
||||
|
||||
;; Collect FILETAGS from the file
|
||||
(when (file-exists-p full-path)
|
||||
(with-temp-buffer
|
||||
(insert-file-contents full-path)
|
||||
(org-mode)
|
||||
(let ((tags (cadr (assoc "FILETAGS"
|
||||
(org-collect-keywords '("FILETAGS"))))))
|
||||
(when tags
|
||||
(setq tags-str
|
||||
(mapconcat
|
||||
(lambda (tag)
|
||||
(format "@@html:<a href=\"/tags/%s.html\"> \
|
||||
<span class=\"post-tag\">%s</span> </a>@@" tag tag))
|
||||
(split-string tags ":" t)
|
||||
" "))))))
|
||||
|
||||
;; Insert month heading whenever month changes
|
||||
(unless (equal month-str current-month)
|
||||
(setq current-month month-str)
|
||||
(setq output (concat output "\n** " month-str "\n")))
|
||||
|
||||
;; Insert the actual entry
|
||||
(setq output
|
||||
(concat output
|
||||
(format "- %s @@html:<span class=\"post-date\">%s</span>@@ %s\n"
|
||||
link date-str tags-str))))))
|
||||
|
||||
output))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
(defun z/categories-sitemap (title _list)
|
||||
"Generate a categories page by scanning tags across org-posts and org-blogs."
|
||||
(let* ((expanded (org-publish-expand-projects org-publish-project-alist))
|
||||
(posts (assoc "org-posts" expanded))
|
||||
(blogs (assoc "org-blogs" expanded))
|
||||
;; DO NOT set :exclude to "" — it excludes everything
|
||||
(files (cl-remove-duplicates
|
||||
(append (and posts (org-publish-get-base-files posts))
|
||||
(and blogs (org-publish-get-base-files blogs)))
|
||||
:test #'file-equal-p))
|
||||
;; optional: drop the generated sitemaps
|
||||
(files (cl-remove-if
|
||||
(lambda (f)
|
||||
(member (file-name-nondirectory f)
|
||||
'("posts-list.org" "blogs-list.org" "sitemap.org" "categories.org")))
|
||||
files))
|
||||
(counts (make-hash-table :test 'equal)))
|
||||
;;(message "files I will scan: %S" files)
|
||||
(dolist (f files)
|
||||
(when (file-readable-p f)
|
||||
(with-temp-buffer
|
||||
(insert-file-contents f)
|
||||
(org-mode)
|
||||
(let* ((kw (org-collect-keywords '("FILETAGS" "TAGS")))
|
||||
(raw (car (or (cdr (assoc "FILETAGS" kw))
|
||||
(cdr (assoc "TAGS" kw))))))
|
||||
(when raw
|
||||
(dolist (tag (split-string raw ":" t))
|
||||
(puthash tag (1+ (gethash tag counts 0)) counts)))))))
|
||||
|
||||
(let (tags)
|
||||
(maphash (lambda (k _) (push k tags)) counts)
|
||||
(setq tags (sort tags #'string-lessp))
|
||||
(concat
|
||||
"#+TITLE: " title "\n#+OPTIONS: toc:nil num:nil title:nil\n\n* Categories (Includes both blogs and posts)\n"
|
||||
(if tags
|
||||
(mapconcat
|
||||
(lambda (tag)
|
||||
(format "- [[file:tags/%s.org][@@html:<span class=\"post-tag\">%s</span>@@]] (%d)"
|
||||
(z/tag-slug tag) tag (gethash tag counts))
|
||||
)
|
||||
tags
|
||||
"\n")
|
||||
"_No tags found yet._")))))
|
||||
|
||||
|
||||
(defun z/tag-slug (s)
|
||||
"Turn a tag into a safe filename."
|
||||
(let ((down (downcase s)))
|
||||
(replace-regexp-in-string "[^a-z0-9]+" "-" down)))
|
||||
|
||||
(defun z/collect-post-files ()
|
||||
"Return all .org files from org-posts and org-blogs."
|
||||
(let* ((expanded (org-publish-expand-projects org-publish-project-alist))
|
||||
(posts (assoc "org-posts" expanded))
|
||||
(blogs (assoc "org-blogs" expanded)))
|
||||
(cl-remove-duplicates
|
||||
(append (and posts (org-publish-get-base-files posts))
|
||||
(and blogs (org-publish-get-base-files blogs)))
|
||||
:test #'file-equal-p)))
|
||||
|
||||
(defun z/gather-tag-index ()
|
||||
"Return hash: tag -> list of (FILE TITLE DATE-ISO)."
|
||||
(let ((idx (make-hash-table :test 'equal)))
|
||||
(dolist (f (z/collect-post-files))
|
||||
(when (and (string-match-p "\\.org\\'" f)
|
||||
(file-readable-p f)
|
||||
;; ignore generated lists
|
||||
(not (member (file-name-nondirectory f)
|
||||
'("posts-list.org" "blogs-list.org" "sitemap.org" "categories.org"))))
|
||||
(with-temp-buffer
|
||||
(insert-file-contents f)
|
||||
(org-mode)
|
||||
(let* ((kw (org-collect-keywords '("TITLE" "FILETAGS" "TAGS" "DATE")))
|
||||
(title (or (car (cdr (assoc "TITLE" kw)))
|
||||
(file-name-base f)))
|
||||
(date (or (car (cdr (assoc "DATE" kw))) "")) ;; optional
|
||||
(raw (car (or (cdr (assoc "FILETAGS" kw))
|
||||
(cdr (assoc "TAGS" kw))))))
|
||||
(when raw
|
||||
(dolist (tag (split-string raw ":" t))
|
||||
(push (list f title date) (gethash tag idx))))))))
|
||||
idx))
|
||||
|
||||
(defun z/write-tag-pages ()
|
||||
"Generate tags/*.org pages listing posts for each tag."
|
||||
(let* ((site-root (expand-file-name "~/master-folder/org_files/org_web/"))
|
||||
(tags-dir (expand-file-name "tags" site-root)))
|
||||
(unless (file-directory-p tags-dir)
|
||||
(make-directory tags-dir t))
|
||||
(let ((idx (z/gather-tag-index)))
|
||||
(maphash
|
||||
(lambda (tag items)
|
||||
(let* ((slug (z/tag-slug tag))
|
||||
(outfile (expand-file-name (format "%s.org" slug) tags-dir)))
|
||||
(with-temp-file outfile
|
||||
(insert (format "#+TITLE: Tag: %s\n#+OPTIONS: toc:nil num:nil title:nil \n\n* Posts tagged %s\n"
|
||||
tag tag))
|
||||
;; sort newest first if DATE present
|
||||
(setq items (sort items (lambda (a b) (string> (nth 2 a) (nth 2 b)))))
|
||||
(dolist (it items)
|
||||
(let* ((file (nth 0 it))
|
||||
(title (nth 1 it))
|
||||
(rel (file-relative-name file tags-dir)))
|
||||
;; link to the source .org; org-publish will rewrite to the .html
|
||||
(insert (format "- [[file:%s][%s]]\n" rel title)))))))
|
||||
idx)
|
||||
)))
|
||||
|
||||
(defun z/filetags-html (info)
|
||||
"Return an HTML snippet for FILETAGS from INFO, or nil if none."
|
||||
(let ((tags (plist-get info :filetags)))
|
||||
(when tags
|
||||
(format
|
||||
"<div class=\"filetags\">%s</div>\n"
|
||||
(mapconcat (lambda (tag)
|
||||
(format "<a href=\"/categories.html\"> <span class=\"post-tag\">%s</span> </a>" tag))
|
||||
tags " ")))))
|
||||
|
||||
(defun z/insert-filetags-after-title (output backend info)
|
||||
"Insert FILETAGS after the first <h1 class=\"title\"> in OUTPUT."
|
||||
(if (org-export-derived-backend-p backend 'html)
|
||||
(let ((block (z/filetags-html info)))
|
||||
(if (and block
|
||||
(string-match "\\(<h1[^>]*class=[\"']title[\"'][^>]*>.*?</h1>\\)" output))
|
||||
(replace-match (concat "\\1\n" block) t nil output)
|
||||
output))
|
||||
output))
|
||||
|
||||
(org-export-define-derived-backend 'z-html 'html
|
||||
:filters-alist '((:filter-final-output . z/insert-filetags-after-title)))
|
||||
|
||||
(defun z/z-publish-to-html (plist filename pub-dir)
|
||||
"Publish FILENAME to HTML using the z-html backend."
|
||||
(org-publish-org-to 'z-html filename ".html" plist pub-dir))
|
||||
|
||||
|
||||
;; Define the publishing project
|
||||
(setq org-publish-project-alist
|
||||
`(("org-main"
|
||||
:recursive t
|
||||
:base-directory "~/master-folder/org_files/org_web/"
|
||||
:publishing-function z/z-publish-to-html
|
||||
:publishing-directory "~/master-folder/org_files/org_web/output"
|
||||
:base-extension "org"
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "sitemap.org"
|
||||
:sitemap-title "Sitemap"
|
||||
:sitemap-sort-files chronologically
|
||||
:html-preamble ,z-preamble
|
||||
:html-postamble ,z-postamble
|
||||
:html-head ,z-shared-head
|
||||
)
|
||||
|
||||
("org-categories-sitemap"
|
||||
:recursive t
|
||||
:base-directory "~/master-folder/org_files/org_web/"
|
||||
:publishing-directory "~/master-folder/org_files/org_web/output"
|
||||
:base-extension "org"
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "categories.org"
|
||||
:sitemap-title "Categories"
|
||||
:sitemap-function z/categories-sitemap
|
||||
:html-preamble ,z-preamble
|
||||
:html-postamble ,z-postamble
|
||||
:html-head ,z-shared-head
|
||||
)
|
||||
("org-posts"
|
||||
:base-directory "~/master-folder/org_files/org_web/posts"
|
||||
:publishing-directory "~/master-folder/org_files/org_web/output/posts/"
|
||||
:recursive t
|
||||
:base-extension "org"
|
||||
:publishing-function z/z-publish-to-html
|
||||
:with-author nil
|
||||
:with-creator nil
|
||||
:html-validation-link nil
|
||||
:with-toc t
|
||||
:section-numbers t
|
||||
:html-preamble ,z-preamble
|
||||
:html-postamble ,z-postamble
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "posts-list.org"
|
||||
:sitemap-title "Posts List"
|
||||
:sitemap-style list
|
||||
:sitemap-function z/posts-sitemap
|
||||
:sitemap-sort-files anti-chronologically
|
||||
:html-head ,z-shared-head
|
||||
)
|
||||
("org-blogs"
|
||||
:base-directory "~/master-folder/org_files/org_web/blogs"
|
||||
:publishing-directory "~/master-folder/org_files/org_web/output/blogs/"
|
||||
:recursive t
|
||||
:base-extension "org"
|
||||
:publishing-function z/z-publish-to-html
|
||||
:with-author nil
|
||||
:with-creator nil
|
||||
:html-validation-link nil
|
||||
:html-preamble ,z-preamble
|
||||
:html-postamble ,z-postamble
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "blogs-list.org"
|
||||
:sitemap-title "Blogs List"
|
||||
:sitemap-style list
|
||||
:sitemap-function z/blogs-sitemap
|
||||
:sitemap-sort-files anti-chronologically
|
||||
:html-head ,z-shared-head
|
||||
)
|
||||
("org-books"
|
||||
:base-directory "~/master-folder/org_files/org_web/books/"
|
||||
:publishing-directory "~/master-folder/org_files/org_web/output/books/"
|
||||
:recursive t
|
||||
:base-extension "org"
|
||||
:publishing-function z/z-publish-to-html
|
||||
:with-author nil
|
||||
:with-creator nil
|
||||
:html-validation-link nil
|
||||
:html-preamble ,z-preamble
|
||||
:html-postamble ,z-postamble
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "books-list.org"
|
||||
:sitemap-title "Books List"
|
||||
:sitemap-style list
|
||||
:sitemap-function z/books-sitemap
|
||||
:sitemap-sort-files anti-chronologically
|
||||
:html-head ,z-shared-head
|
||||
)
|
||||
("org-2025"
|
||||
:base-directory "~/master-folder/org_files/org_web/blogs/2025/"
|
||||
:publishing-directory "~/master-folder/org_files/org_web/output/blogs/2025/"
|
||||
:recursive t
|
||||
:base-extension "org"
|
||||
:publishing-function z/z-publish-to-html
|
||||
:with-author nil
|
||||
:with-creator nil
|
||||
:html-validation-link nil
|
||||
:html-preamble ,z-preamble
|
||||
:html-postamble ,z-postamble
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "2025-list.org"
|
||||
:sitemap-title "2025 List"
|
||||
:sitemap-style list
|
||||
:sitemap-function z/2025-sitemap
|
||||
:sitemap-sort-files anti-chronologically
|
||||
:html-head ,z-shared-head
|
||||
)
|
||||
("org-career"
|
||||
:base-directory "~/master-folder/org_files/org_web/posts/career/"
|
||||
:publishing-directory "~/master-folder/org_files/org_web/output/posts/career/"
|
||||
:recursive t
|
||||
:base-extension "org"
|
||||
:publishing-function z/z-publish-to-html
|
||||
:with-author nil
|
||||
:with-creator nil
|
||||
:html-validation-link nil
|
||||
:html-preamble ,z-preamble
|
||||
:html-postamble ,z-postamble
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "career-list.org"
|
||||
:sitemap-title "Career List"
|
||||
:sitemap-style list
|
||||
:sitemap-function z/career-sitemap
|
||||
:sitemap-sort-files anti-chronologically
|
||||
:html-head ,z-shared-head
|
||||
)
|
||||
("org-tags"
|
||||
:base-directory "~/master-folder/org_files/org_web/tags"
|
||||
:publishing-directory "~/master-folder/org_files/org_web/output/tags"
|
||||
:recursive t
|
||||
:base-extension "org"
|
||||
:publishing-function org-html-publish-to-html
|
||||
:with-author nil
|
||||
:with-creator nil
|
||||
:html-preamble ,z-preamble
|
||||
:html-postamble ,z-postamble
|
||||
:html-head ,z-shared-head)
|
||||
("org-assets"
|
||||
:base-directory "~/master-folder/org_files/org_web/assets/"
|
||||
:base-extension "css\\|js\\|png\\|jpg\\|gif\\|svg\\|pdf\\|woff\\|woff2\\|ttf"
|
||||
:publishing-directory "~/master-folder/org_files/org_web/output/assets/"
|
||||
:recursive t
|
||||
:publishing-function org-publish-attachment)
|
||||
))
|
||||
|
||||
(delete-directory "~/master-folder/org_files/org_web/output/" t)
|
||||
(delete-directory "~/master-folder/org_files/org_web/tags/" t)
|
||||
(message "Directory deleted")
|
||||
|
||||
(z/write-tag-pages)
|
||||
(org-publish-all t)
|
||||
|
||||
(message "Build complete!")
|
||||
|
||||
;;; build-site.el ends here
|
||||
|
||||
#+END_SRC
|
||||
|
||||
* Publish Script
|
||||
|
||||
As the project is hosted on Github, I have created a small script that is able to push changes to the remote repository, which Cloudflare will automatically detect and rebuild the website:
|
||||
|
||||
#+BEGIN_SRC bash
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
# Exit immediately if any command fails
|
||||
set -e
|
||||
|
||||
# Define paths
|
||||
ORG_OUTPUT_DIR="$HOME/master-folder/org_files/org_web/output"
|
||||
|
||||
cd "$ORG_OUTPUT_DIR"
|
||||
|
||||
echo "HTML published to: $ORG_OUTPUT_DIR"
|
||||
|
||||
# Git commands
|
||||
echo "Adding changes to Git..."
|
||||
git add .
|
||||
|
||||
echo "Committing..."
|
||||
git commit -m "Auto-publish on $(date)" || echo "Nothing to commit."
|
||||
|
||||
echo "Pushing to GitHub..."
|
||||
git push origin main
|
||||
|
||||
echo "Done! Changes pushed and Cloudflare should rebuild the site."
|
||||
|
||||
#+END_SRC
|
||||
|
||||
[fn:1] See: [[~/master-folder/org_files/org_web/blogs/publish-pages.org][this link]]
|
||||
21
home/status.org
Normal file
21
home/status.org
Normal file
@@ -0,0 +1,21 @@
|
||||
#+TITLE: Competency Status Board
|
||||
#+OPTIONS: toc:nil num:nil
|
||||
#+NO_SIDENOTES: t
|
||||
#+COMMENTS: t
|
||||
#+SLUG: competency-board
|
||||
|
||||
|
||||
This page shows the status of the competencies I am working on (*grad*)
|
||||
|
||||
#+BEGIN_EXPORT html
|
||||
<div id="kanban-board">
|
||||
<p>Loading status…</p>
|
||||
</div>
|
||||
<div id="mobile-move-panel" aria-hidden="true">
|
||||
<select id="move-item"></select>
|
||||
<select id="move-from" disabled></select>
|
||||
<select id="move-to"></select>
|
||||
<button id="move-confirm">Move</button>
|
||||
</div>
|
||||
|
||||
#+END_EXPORT
|
||||
16
home/status.org~
Normal file
16
home/status.org~
Normal file
@@ -0,0 +1,16 @@
|
||||
#+TITLE: Competency Status Board
|
||||
#+OPTIONS: toc:nil num:nil
|
||||
#+NO_SIDENOTES: t
|
||||
#+COMMENTS: t
|
||||
#+SLUG: competency-board
|
||||
|
||||
|
||||
This page shows the status of the competencies I am working on (*grad*)
|
||||
|
||||
#+BEGIN_EXPORT html
|
||||
<div id="kanban-board">
|
||||
<p>Loading status…</p>
|
||||
</div>
|
||||
|
||||
<script src="../assets/scripts/status-board.js"></script>
|
||||
#+END_EXPORT
|
||||
Reference in New Issue
Block a user