2026-05-14 Thursday
changed the Daily location
As per https://www.orgroam.com/manual.html#org_002droam_002ddailies↗
13.3.1 Configuration
For org-roam-dailies to work, you need to define two variables:
Variable: org-roam-dailies-directory
Path to daily-notes. This path is relative to org-roam-directory.
Variable: org-roam-dailies-capture-templates
Capture templates for daily-notes in Org-roam.
Here is a sane default configuration:
(setq org-roam-dailies-directory “daily/”)
(setq org-roam-dailies-capture-templates ‘((“d” “default” entry “* %?” :target (file+head “%<%Y-%m-%d>.org” “#+title: %<%Y-%m-%d>\n”))))
Testing the change in Directory
Restarted emacs to test the change the Directory for dailies.
The below code is shown in dailies capture template. When saved, it gets discarded.
*
:PROPERTIES:
:EXPORT_FILE_NAME: 2026-05-14
:END:
%?
Findings on the dailies capture saga
The main conclusion is that dailies capture template require a function to be called as a hook for one-file-per-datetree to work properly.
(defun my/set-daily-export-file-name ()
(when (string-match-p "daily_journal\\.org$" (buffer-file-name))
(save-excursion
(org-up-heading-safe)
(unless (org-entry-get nil "EXPORT_FILE_NAME")
(org-entry-put nil "EXPORT_FILE_NAME"
(format-time-string "%Y-%m-%d" (org-capture-get :default-time)))))))
(add-hook 'org-capture-before-finalize-hook #'my/set-daily-export-file-name)
A stray entry of “#+date” caused the posts to pickup wrong date.
** April
*** 2023-04-24 Monday
:PROPERTIES:
:ID: c33722bc-a466-4391-9fb6-cc104ff23093
:END:
#+date: 2026-02-05T16:50:39+05:30
prabu@homepc2 ~> head /data/myhome/prabu/org/my_hugo_site/content/journal/2026-05-08.md
+++
title = "2026-05-08 Friday"
author = ["Prabu Anand Kalivaradhan"]
date = 2026-02-05T16:50:39+05:30
lastmod = 2026-05-14T12:52:55+05:30
draft = false
+++
```emacs-lisp
**** Test
Testing the null guard
This is for testing the null guard to avoid below error..
string-match-p: Wrong type argument: stringp, nil
fixed code..
(defun my/set-daily-export-file-name ()
(when (and (buffer-file-name)
(string-match-p "daily_journal\\.org$" (buffer-file-name)))
(save-excursion
(org-up-heading-safe) ; go to *** day heading
(unless (org-entry-get nil "EXPORT_FILE_NAME")
(org-entry-put nil "EXPORT_FILE_NAME"
(format-time-string "%Y-%m-%d" (org-capture-get :default-time)))))))
Fixed known past mistakes
- Remove time-stamp block entirely from init.el — ox-hugo handles lastmod via org-hugo-auto-set-lastmod t
- Clean up stray #+date: lines in daily_journal.org and then delete them all.
grep -n "^#+date:" /data/myhome/prabu/org/Resources/daily_journal.org - Fix layouts/_partials/date.html to use .Date for journals, .Lastmod for docs — use Hugo’s section context:
{{- $date := .Date -}} {{- if and .Lastmod (not (eq .Section "journal")) -}} {{- $date = .Lastmod -}} {{- end -}} <time class="site-date" datetime="{{ $date.Format "2006-01-02" }}"> {{ $date.Format "Jan 02, 2006" }} </time>
Missing field - EXPORT_DATE
From ox-hugo↗ site: Alternative way to set the date field
If you prefer to not insert time-stamps using the DONE-state switching (i.e. you have org-log-done at its default value of nil), you can explicitly insert the EXPORT_DATE property too using the below definition of org-hugo-new-subtree-post-capture-template instead.
(defun org-hugo-new-subtree-post-capture-template ()
"Returns `org-capture' template string for new Hugo post.
See `org-capture-templates' for more information."
(let* (;; http://www.holgerschurig.de/en/emacs-blog-from-org-to-hugo/
(date (format-time-string (org-time-stamp-format :long :inactive) (org-current-time)))
(title (read-from-minibuffer "Post Title: ")) ;Prompt to enter the post title
(fname (org-hugo-slug title)))
(mapconcat #'identity
`(
,(concat "* TODO " title)
":PROPERTIES:"
,(concat ":EXPORT_FILE_NAME: " fname)
,(concat ":EXPORT_DATE: " date) ;Enter current date and time
":END:"
"%?\n") ;Place the cursor here finally
"\n")))
So, the function for per file per day is as follows:
(defun my/set-daily-export-file-name ()
(when (and (buffer-file-name)
(string-match-p "daily_journal\\.org$" (buffer-file-name)))
(save-excursion
(org-up-heading-safe)
(unless (org-entry-get nil "EXPORT_FILE_NAME")
(org-entry-put nil "EXPORT_FILE_NAME"
(format-time-string "%Y-%m-%d" (org-capture-get :default-time))))
(unless (org-entry-get nil "EXPORT_DATE")
(org-entry-put nil "EXPORT_DATE"
(format-time-string "%Y-%m-%d" (org-capture-get :default-time)))))))
snippet that added EXPORT_FILE_NAME and EXPORT_DATE
(with-current-buffer (find-file-noselect "/data/myhome/prabu/org/Resources/daily_journal.org")
(org-map-entries
(lambda ()
(when (= (org-outline-level) 3)
(let* ((heading (org-get-heading t t t t))
(date-str (when (string-match "\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}\\)" heading)
(match-string 1 heading))))
(when date-str
(unless (org-entry-get nil "EXPORT_FILE_NAME")
(org-entry-put nil "EXPORT_FILE_NAME" date-str))
(unless (org-entry-get nil "EXPORT_DATE")
(org-entry-put nil "EXPORT_DATE" date-str))))))
nil 'file)
(save-buffer))
This snippet:
- Only processes level 3 headings (* day)
- Extracts the date directly from the heading title via regex — so * 2023-04-24 Monday gives 2023-04-24
- Respects existing properties via unless
- Saves the file after
Claude responded: Two ways:
Ways to Run lisp code:
From scratch buffer — open a scratch buffer with M-x ielm or switch to scratch buffer, paste the snippet and press C-x C-e at the end of the last closing parenthesis.
Directly from minibuffer — M-: then paste the snippet and press RET.
© Prabu Anand K 2020-2026