home

My NixOS systems configurations.
Log | Files | Refs | LICENSE

commit 8b8e1cbaf08d1160e7506308d18d6f1de667bd74
parent bc7963d4103ad8cd64e4522c08cd1751c69d75c9
Author: Vincent Demeester <vincent@sbr.pm>
Date:   Sat,  7 May 2022 14:38:22 +0200

www/vincent.demeester.fr: update some export functions

Signed-off-by: Vincent Demeester <vincent@sbr.pm>

Diffstat:
Mdocs/moving-home-to-nix-flakes.org | 3++-
Rwww/vincent.demeester.fr/content/posts/2022-05-05-random.org -> www/vincent.demeester.fr/content/2022/random.org | 0
Mwww/vincent.demeester.fr/content/index.org | 4+++-
Mwww/vincent.demeester.fr/content/sitemap.org | 11+++++------
Mwww/vincent.demeester.fr/lib/publish-common.el | 36++++++++++++++++++++++++++----------
Mwww/vincent.demeester.fr/lib/publish.el | 34+++++++++++++++++++++++++++-------
Mwww/vincent.demeester.fr/tasks.org | 7+++++++
7 files changed, 70 insertions(+), 25 deletions(-)

diff --git a/docs/moving-home-to-nix-flakes.org b/docs/moving-home-to-nix-flakes.org @@ -1,5 +1,6 @@ #+TITLE: Moving =home= to nix flakes #+FILETAGS: #home nix dotfiles configuration +#+SETUPFILE: ../www/vincent.demeester.fr/templates/2022.org This document is a /live/ document on moving this =monorepo= to using nix flakes. It will go through why as well as trying to dig around what was done for it. @@ -31,4 +32,4 @@ For a "configuration" repository, I think it makes perfect sense. For standalone flakes, like projects, … I wouldn't say the same but for this one it does. -#+include: "../flake.nix" +#+include: "../flake.nix" src nix diff --git a/www/vincent.demeester.fr/content/posts/2022-05-05-random.org b/www/vincent.demeester.fr/content/2022/random.org diff --git a/www/vincent.demeester.fr/content/index.org b/www/vincent.demeester.fr/content/index.org @@ -12,9 +12,11 @@ below is a "selection" of some content. If you are looking for an "index" of all pages (almost), there is a [[file:sitemap.org][sitemap]]. -- [[file:posts/2022-05-05-random.org][Random thoughts after 2 years]] +- [[file:2022/random.org][Random thoughts after 2 years]] - [[file:sandbox.org][Sandbox]], where I try the /design/ of the website. +See also some [[http:/docs/sitemap.html][documentation]] publish from my [[monorepo][mono-repo]]. + #+BEGIN_EXPORT html <small class='opinions'>Opinions stated here are my own and do not express the views of my employer, spouse, children, pets, neighbors, secret crushes, favorite authors, or anyone else who is not me. And maybe not even me, depending on how old this is.</small><br/> <small class='engine'> diff --git a/www/vincent.demeester.fr/content/sitemap.org b/www/vincent.demeester.fr/content/sitemap.org @@ -1,8 +1,7 @@ -#+TITLE: content +#+TITLE: Sitemap - [[file:index.org][Hi, I'm Vincent Demeester]] +- [[file:about.org][About me]] - [[file:sandbox.org][Emacs org-mode sandbox]] -- posts - - [[file:posts/2022-05-05-random.org][Random thoughts after 2 years]] -- about - - [[file:about/index.org][About me]]- \ No newline at end of file +- 2022 + - [[file:2022/random.org][Random thoughts after 2 years]]+ \ No newline at end of file diff --git a/www/vincent.demeester.fr/lib/publish-common.el b/www/vincent.demeester.fr/lib/publish-common.el @@ -68,22 +68,35 @@ content is the content of the drawer" (defvar sbr-website-html-head "<link rel='icon' type='image/x-icon' href='/images/favicon.ico'/> <meta name='viewport' content='width=device-width, initial-scale=1'> +<link rel='stylesheet' href='/css/2022.css' type='text/css'/> +<link rel='stylesheet' href='/css/syntax.css' type='text/css'/> +<link href='/index.xml' rel='alternate' type='application/rss+xml' title='Vincent Demeester' />") + +(defvar legacy-sbr-website-html-head + "<link rel='icon' type='image/x-icon' href='/images/favicon.ico'/> +<meta name='viewport' content='width=device-width, initial-scale=1'> <link rel='stylesheet' href='/css/new.css' type='text/css'/> <link rel='stylesheet' href='/css/syntax.css' type='text/css'/> <link href='/index.xml' rel='alternate' type='application/rss+xml' title='Vincent Demeester' />") +(defun islegacy (file) + "Returns t if FILE is in the legacy folder" + (string-prefix-p "www/vincent.demeester.fr/content/legacy" + (file-relative-name file + (expand-file-name (locate-dominating-file default-directory ".git"))))) + (defun sbr-website-html-preamble (plist) "PLIST: An entry." - ;; Skip adding subtitle to the post if :KEYWORDS don't have 'post' has a - ;; keyword - (when (string-match-p "post" (format "%s" (plist-get plist :keywords))) - (plist-put plist - :subtitle (format "Published on %s by %s." - (org-export-get-date plist sbr-date-format) - (car (plist-get plist :author))))) - - ;; Below content will be added anyways - "<nav style=\"background: yellow;\">This part of the website is \"archived\", it means it is \"stuck in time\" and won't be updated/up-to-date</nav> + (cond ((islegacy (plist-get plist :input-file)) + ;; Legacy handling + ;; Skip adding subtitle to the post if :KEYWORDS don't have 'post' has a + ;; keyword + (when (string-match-p "post" (format "%s" (plist-get plist :keywords))) + (plist-put plist + :subtitle (format "Published on %s by %s." + (org-export-get-date plist sbr-date-format) + (car (plist-get plist :author))))) + (format "<nav style=\"background: yellow;\">This part of the website is \"archived\", it means it is \"stuck in time\" and won't be updated/up-to-date</nav> <nav> <img src=\"/images/favicon.ico\" id=\"sitelogo\"/> <a href='/'>home</a> / <a href='/posts/'>posts</a> (<a href='/index.xml'>rss</a>) / @@ -91,6 +104,9 @@ content is the content of the drawer" <a href='https://dl.sbr.pm/'>files</a> / <a href='/about/'>about</a></li> </nav>") + ) + (t nil)) + ) (defvar sbr-website-html-postamble "<footer> diff --git a/www/vincent.demeester.fr/lib/publish.el b/www/vincent.demeester.fr/lib/publish.el @@ -23,17 +23,37 @@ :with-toc nil :with-drawers t :sitemap-filename "sitemap.org" - :sitemap-title "content" + :sitemap-title "Sitemap" ;; :sitemap-format-entry sbr/org-sitemap-format-entry :sitemap-style tree :sitemap-sort-files anti-chronologically :html-head-include-default-style nil :html-head-include-scripts nil ;; :sitemap-function sbr/org-publish-sitemap - ;; :html-head ,sbr-website-html-head - ;; :html-preamble sbr-website-html-preamble + :html-head ,sbr-website-html-head + :html-preamble sbr-website-html-preamble :html-postamble ,sbr-website-html-postamble ) + ("docs" + :base-directory "../../docs" + :base-extension "org" + :publishing-function org-html-publish-to-html + :publishing-directory "./public/docs/" + :exclude ,(regexp-opt '("README.org" "draft" "private.org")) + :index-filename "index.org" + :auto-sitemap t + :with-footnotes t + :with-toc nil + :with-drawers t + :sitemap-filename "sitemap.org" + :sitemap-title "Docs sitemap" + :sitemap-style tree + :sitemap-sort-files anti-chronologically + :html-head-include-default-style nil + :html-head-include-scripts nil + :html-head ,sbr-website-html-head + :html-preamble sbr-website-html-preamble + :html-postamble ,sbr-website-html-postamble) ;; TODO: add rss for content, from https://writepermission.com/org-blogging-rss-feed.html ("css" :base-directory "./css" @@ -74,7 +94,7 @@ :sitemap-function sbr/org-publish-sitemap :html-head-include-scripts nil :html-head-include-default-style nil - :html-head ,sbr-website-html-head + :html-head ,legacy-sbr-website-html-head :html-preamble sbr-website-html-preamble :html-postamble ,sbr-website-html-postamble) ("posts-rss" @@ -109,7 +129,7 @@ ;;:sitemap-function sbr/org-publish-sitemap :html-head-include-scripts nil :html-head-include-default-style nil - :html-head ,sbr-website-html-head + :html-head ,legacy-sbr-website-html-head :html-preamble sbr-website-html-preamble :html-postamble ,sbr-website-html-postamble) ("articles-assets" @@ -132,7 +152,7 @@ :publishing-directory "./public/about" :html-head-include-scripts nil :html-head-include-default-style nil - :html-head ,sbr-website-html-head + :html-head ,legacy-sbr-website-html-head :html-preamble sbr-website-html-preamble :html-postamble ,sbr-website-html-postamble) ("legacy" @@ -141,7 +161,7 @@ :publishing-directory "./public/" :publishing-function org-publish-attachment :recursive t) - ("all" :components ("content" "posts" "articles" "articles-assets" "css" "images" "assets" "legacy" "posts-rss")))) + ("all" :components ("content" "docs" "posts" "articles" "articles-assets" "css" "images" "assets" "legacy" "posts-rss")))) (defun publish () "Build vincent.demeester.fr website" diff --git a/www/vincent.demeester.fr/tasks.org b/www/vincent.demeester.fr/tasks.org @@ -1,5 +1,12 @@ #+TITLE: tasks +* TODO Make all in legacy as static + +Once I settle with this setup, I should make all in legacy as html.. that way I can +rewrite =emacs-lisp= without any trouble. + +There is a trick to it though… + * TODO Set =<mark>= with orgmode - https://emacs.stackexchange.com/questions/36496/how-to-mark-code-fragments-in-org-export