From: Frederik Vanrenterghem Date: Thu, 28 Dec 2023 03:13:26 +0000 (+0800) Subject: Gebruik absolute uri voor include tag index. X-Git-Url: http://git.vanrenterghem.biz/www2.vanrenterghem.biz.git/commitdiff_plain/6f619da7c591593af4470c8e1700f09e4c2b2dd3 Gebruik absolute uri voor include tag index. --- diff --git a/html/post-index.mustache b/html/post-index.mustache index 9a0923b..7883bbd 100644 --- a/html/post-index.mustache +++ b/html/post-index.mustache @@ -12,7 +12,7 @@ diff --git a/maak-website.el b/maak-website.el index a30d8e2..10f2e6a 100644 --- a/maak-website.el +++ b/maak-website.el @@ -48,14 +48,19 @@ (defun my-blog-create-tags-files (plist) "Create org files for each tag defined in FILETAGS in posts, storing them in my-blog-tags-folder." - (unless (file-directory-p my-blog-tags-folder) (make-directory my-blog-tags-folder)) - (with-temp-file (file-name-concat my-blog-source-folder "tag-index.org") + (let* ((tagfolder (file-name-concat + (plist-get (cdr (assoc "landing" org-publish-project-alist)) :base-directory))) + (postfolder (file-name-concat + (plist-get (cdr (assoc "posts" org-publish-project-alist)) :base-directory))) + (relpostfolder (file-relative-name postfolder tagfolder))) + (unless (file-directory-p my-blog-tags-folder) (make-directory my-blog-tags-folder)) + (with-temp-file (file-name-concat tagfolder "tag-index.org") (insert (concat "#+mustache-template: " (file-name-concat my-blog-mustache-folder "tags-index.mustache") "\n")) (insert (concat "#+TITLE: Blog - All tags\n")) (insert "#+OPTIONS: ^:nil\n") ; do not use underscores as subscript (insert "\n") (dolist (tag (sort (my-org-get-all-filetags) (lambda (x y) (string-lessp (car x) (car y))) )) - (insert (concat "- [[file:" (file-name-concat my-blog-posts-folder (concat "tag-" (car tag) ".org")) "][" (car tag) "]]\n")))) + (insert (concat "- [[file:" (file-name-concat relpostfolder (concat "tag-" (car tag) ".org")) "][" (car tag) "]]\n"))))) (dolist (tag (my-org-get-all-filetags)) (with-temp-file (file-name-concat my-blog-tags-folder (concat "tag-" (car tag) ".org")) (insert (concat "#+mustache-template: " (file-name-concat my-blog-mustache-folder "tags.mustache") "\n")) @@ -195,14 +200,15 @@ representation for the files to include, as returned by (defun my-blog-cleanup-sitemaps (plist) "Clean up temporary files created in the process of publishing" - ;; Create a body-only version of the tags index. + ;; Create a body-only version of the tags index. Needs absolute path to posts folder. (with-temp-file (file-name-concat - (plist-get (cdr (assoc "posts" org-publish-project-alist)) :publishing-directory) + (plist-get (cdr (assoc "landing" org-publish-project-alist)) :publishing-directory) "tag-index-body.html") (insert-file-contents (file-name-concat (plist-get (cdr (assoc "landing" org-publish-project-alist)) :base-directory) "tag-index.org")) - (org-export-to-buffer 'mustache-html (current-buffer) nil nil nil t nil)) + (org-export-to-buffer 'mustache-html (current-buffer) nil nil nil t nil) + (replace-string "href=\"posts" "href=\"/posts")) (delete-file (file-name-concat my-blog-source-folder "sitemap.org")) (delete-file (file-name-concat my-blog-posts-folder "sitemap.org")) (delete-file (file-name-concat my-blog-posts-folder "sitemap.org~")))