Lots of updates - restructured, added things...

This commit is contained in:
2026-05-14 20:38:40 +03:00
parent 74ada1c5cf
commit 3b98043a61
10 changed files with 323 additions and 88 deletions
+86 -26
View File
@@ -10,23 +10,61 @@
org-html-head-include-scripts nil)
(setq site-nav
"<nav>
<div class=\"nav-links\">
<a href=\"/\">Home</a>
<a href=\"/about.html\">About</a>
<a href=\"/blog.html\">Blog</a>
</div>
<div class=\"nav-contact\">
<a href=\"mailto:aner@zakobar.com\" class=\"contact-link\">
<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"2\" y=\"4\" width=\"20\" height=\"16\" rx=\"2\"/><path d=\"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7\"/></svg>
aner@zakobar.com
</a>
<a href=\"https://www.linkedin.com/in/aner-zakobar/\" class=\"contact-link\" target=\"_blank\" rel=\"noopener\">
<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6z\"/><rect x=\"2\" y=\"9\" width=\"4\" height=\"12\"/><circle cx=\"4\" cy=\"4\" r=\"2\"/></svg>
linkedin.com/in/aner-zakobar
</a>
</div>
</nav>")
"<div class=\"site-contact\">
<a href=\"mailto:aner@zakobar.com\" class=\"contact-link\">
<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"2\" y=\"4\" width=\"20\" height=\"16\" rx=\"2\"/><path d=\"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7\"/></svg>
aner@zakobar.com
</a>
<a href=\"https://www.linkedin.com/in/aner-zakobar/\" class=\"contact-link\" target=\"_blank\" rel=\"noopener\">
<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6z\"/><rect x=\"2\" y=\"9\" width=\"4\" height=\"12\"/><circle cx=\"4\" cy=\"4\" r=\"2\"/></svg>
linkedin.com/in/aner-zakobar
</a>
</div>")
(setq blog-nav
"<div class=\"blog-nav\">
<a href=\"/\" class=\"back-link\">← aner.zakobar.com</a>
</div>")
(defun things-extract-keyword (file keyword)
"Extract #+KEYWORD: value from FILE, or nil if absent/empty."
(with-temp-buffer
(insert-file-contents file)
(goto-char (point-min))
(when (re-search-forward
(concat "^#\\+" keyword ":[ \t]*\\(.*\\)$") nil t)
(let ((v (string-trim (match-string 1))))
(unless (string= v "") v)))))
(defun things-generate-page (_project)
"Scan things/ and write content/generated/things-body.org."
(let* ((things-dir "./things")
(gen-dir "./content/generated")
(files (when (file-directory-p things-dir)
(file-expand-wildcards (concat things-dir "/*.org") t))))
(make-directory gen-dir t)
(with-temp-file (concat gen-dir "/things-body.org")
(insert "#+BEGIN_EXPORT html\n<div class=\"things-grid\">\n")
(dolist (file files)
(let* ((title (things-extract-keyword file "THINGS_TITLE"))
(desc (things-extract-keyword file "THINGS_DESC"))
(path (things-extract-keyword file "THINGS_PATH"))
)
(when (and title desc path)
(insert
(concat
"<div class=\"things-card\">\n"
" <div class=\"things-card-body\">\n"
" <h3><a href=\"/" path "/\">" title "</a></h3>\n"
" <p>" desc "</p>\n"
" </div>\n"
"</div>\n")))))
(insert "</div>\n#+END_EXPORT\n"))))
(defun site-prepare (project)
"Run all site preparation steps."
(blog-generate-listings project)
(things-generate-page project))
(defun blog-extract-title (file)
"Extract #+TITLE: value from FILE."
@@ -77,24 +115,29 @@
(concat
"*[[" link "][" title "]]* — " date "\n\n"
excerpt "\n\n"
"[[" link "][Read more →]]\n\n"
"-----\n\n")))))
"[[" link "][Read more →]]\n\n")))))
(make-directory gen-dir t)
(with-temp-file (concat gen-dir "/recent-posts.org")
(dolist (file (seq-take files 3))
(insert (funcall make-entry file))))
(let ((first t))
(dolist (file (seq-take files 3))
(unless first (insert "-----\n\n"))
(insert (funcall make-entry file))
(setq first nil))))
(with-temp-file (concat gen-dir "/all-posts.org")
(dolist (file files)
(insert (funcall make-entry file))))))
(let ((first t))
(dolist (file files)
(unless first (insert "-----\n\n"))
(insert (funcall make-entry file))
(setq first nil))))))
(setq org-publish-project-alist
`(("site-pages"
:base-directory "./content"
:base-extension "org"
:publishing-directory "./public"
:recursive t
:exclude "generated/"
:exclude "generated/\\|blog/"
:publishing-function org-html-publish-to-html
:preparation-function blog-generate-listings
:preparation-function site-prepare
:html-head-include-default-style nil
:html-head-include-scripts nil
:html-head "<link rel=\"stylesheet\" href=\"/style.css\"><script src=\"/animation.js\" defer></script>"
@@ -106,6 +149,23 @@
:section-numbers nil
:with-toc nil)
("site-blog"
:base-directory "./content/blog"
:base-extension "org"
:publishing-directory "./public/blog"
:recursive nil
:publishing-function org-html-publish-to-html
:html-head-include-default-style nil
:html-head-include-scripts nil
:html-head "<link rel=\"stylesheet\" href=\"/style.css\"><script src=\"/animation.js\" defer></script>"
:html-preamble ,blog-nav
:html-postamble nil
:with-author nil
:with-creator nil
:with-timestamps nil
:section-numbers nil
:with-toc nil)
("site-static"
:base-directory "./static"
:base-extension "css\\|js\\|png\\|jpg\\|jpeg\\|gif\\|svg\\|ico\\|woff2\\|woff\\|ttf"
@@ -114,6 +174,6 @@
:publishing-function org-publish-attachment)
("site"
:components ("site-pages" "site-static"))))
:components ("site-pages" "site-blog" "site-static"))))
(org-publish "site" t)