From 785eaf323ac4198b2df8adac5973e2052b487a0a Mon Sep 17 00:00:00 2001 From: Frederik Vanrenterghem Date: Mon, 11 Dec 2023 22:07:29 +0800 Subject: [PATCH] Zorg dat datums minstens werken. --- maak-website.el | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/maak-website.el b/maak-website.el index f20dc4b..3c6326e 100644 --- a/maak-website.el +++ b/maak-website.el @@ -1,8 +1,9 @@ (require 'ox-publish) +(load "~/.emacs.d/lisp/mustache-html.el") (setq org-html-doctype "html5") (setq org-html-head-include-default-style nil) -;(setq org-html-htmlize-output-type 'css) ; default: 'inline-css +(setq org-html-htmlize-output-type 'css) ; default: 'inline-css (defun my-org-publish-sitemap-default-entry (entry style project) @@ -63,7 +64,7 @@ Either the section between #+BEGIN_PREVIEW and +#END_PREVIEW is used, or the fir (articles (my-blog-sort-article-list filenames project-plist))) (dolist (file filenames) (let* ((abspath (file-name-concat "/home/frederik/websites/stage.vanrenterghem.biz/source/posts" file)) - (relpath (file-relative-name abspath "/home/frederik/websites/stage.vanrenterghem.biz/")) + (relpath (file-relative-name abspath "/home/frederik/websites/stage.vanrenterghem.biz/source/posts/")) (title (org-publish-find-title file project-plist)) (date (format-time-string (car org-time-stamp-formats) (org-publish-find-date file project-plist))) (preview (my-blog-get-preview abspath)) @@ -97,26 +98,36 @@ Either the section between #+BEGIN_PREVIEW and +#END_PREVIEW is used, or the fir (buffer-string)))) (defun my-plain-publish-sitemap-default (title list) - "Default site map, as a string. + "Create a simple site map, as a string. TITLE is the title of the site map. LIST is an internal representation for the files to include, as returned by -`org-list-to-lisp'. PROJECT is the current project." +`org-list-to-lisp'." (with-temp-file "~/websites/stage.vanrenterghem.biz/source/sitemap.org" - (insert "#+OPTIONS: ^:nil\n") ; do not use underscores as subscript - (insert (concat "#+TITLE: " title "\n\n")) - (insert (org-list-to-org list)))) + (let* ((filenames (my-blog-parse-sitemap-list list)) + (project-plist (assoc "posts" org-publish-project-alist)) + (articles (my-blog-sort-article-list filenames project-plist))) + (dolist (file filenames) + (let* ((abspath (file-name-concat "/home/frederik/websites/stage.vanrenterghem.biz/source/posts" file)) + (relpath (file-relative-name abspath "/home/frederik/websites/stage.vanrenterghem.biz/source/")) + (title (org-publish-find-title file project-plist)) + (date (format-time-string "%e %b %Y" (org-publish-find-date file project-plist)))) + (insert (concat "* [[file:" relpath "][" date " - " title "]]\n")))) + (goto-char (point-min)) + (insert "#+OPTIONS: ^:nil\n")))) ; do not use underscores as subscript (setq org-publish-project-alist '(("landing" :base-directory "~/websites/stage.vanrenterghem.biz/source/" :base-extension "org" - :include ("posts/sitemap.org") + ;:include ("posts/sitemap.org") :publishing-directory "~/websites/stage.vanrenterghem.biz/target" :publishing-function org-mustache-html-publish-to-html :mustache-template "~/websites/stage.vanrenterghem.biz/html/landing.mustache" - :headline-levels 3 + :headline-levels 2 :section-numbers nil :with-toc nil + :with-title nil + :html-content-class nil :html-head-include-default-style nil :html-head nil :html-divs nil @@ -130,7 +141,7 @@ representation for the files to include, as returned by :publishing-directory "~/websites/stage.vanrenterghem.biz/target/posts" :publishing-function org-mustache-html-publish-to-html :mustache-template "~/websites/stage.vanrenterghem.biz/html/post.mustache" - :exclude "assets*\\|index.org" ;"assets*\\|sitemap.org\\|index.org" ;; regexp + :exclude "html*\\|assets*\\|index.org" ;"assets*\\|sitemap.org\\|index.org" ;; regexp :html-content-class nil :section-numbers nil :with-toc nil -- 2.39.5