5

It turns out to be that the titles are cached and originally they are not supposed to change frequently.

One workaround is to delete all the cache:

Cache in ~/.org-timestamps doesn't get updated to reflect the change in page title. Deleting everything under the folder and re-publish then everything goes fine, until page titles are changed again.

For more detail, see the link in the comment below.


In my org-mode project, modified page title is not updated in sitemap after re-publish. I did following steps to reproduce:

  1. a.org(title A) --> change title to AA --> re-publish --> title in sitemap.org: A -->

  2. rename a.org(AA) to b.org(AA) --> re-publish --> title in sitemap.org: AA -->

  3. change b.org(AA) to b.org(BB) --> re-publish --> title in sitemap.org: AA

Here for (1) and (3) the sitemap doesn't reflect the change in page title.

What I tried:

  • Invoke org-publish-project, delete published contents, re-publish, doesn't work

  • Add prefix C-u to org-publish-project, delete published contents, re-publish, doesn't work

It seems to be some kinds of sitemap cache, but I couldn't find any clue.

I am using GNU Emacs for Mac OS X 26.1.

Below is my project configuration init.el:

(setq make-backup-files nil)

(setq project-dir (file-name-directory load-file-name))
(setq publish-dir (concat project-dir (file-name-as-directory "publish")))
(setq css-dir (concat project-dir (file-name-as-directory "css")))


(setq current-theme "readtheorg")

(load (concat project-dir "src/theme.el"))

;; for latex

(setq org-latex-pdf-process
  '("latexmk -pdflatex='pdflatex -interaction nonstopmode' -pdf -bibtex -f %f"))

(org-babel-do-load-languages
 'org-babel-load-languages
 '((emacs-lisp . t)
   (clojure . t)
   (shell . t)
   (ditaa . t)
   (dot . t)
   (plantuml . t)))


;; org project

(require 'ox-publish)

(setq org-publish-project-alist
      `(("org"
     :components("org-pages" "org-assets"))
    ("org-pages"
     :base-directory "."
     :base-extension "org"
     :publishing-directory ,publish-dir
     :makeindex t
     :recursive t
     :publishing-function org-html-publish-to-html
     :with-author "Myself"
     :headline-levels 4
     :auto-preamble t
     :auto-sitemap t
     :sitemap-title "Notes"
     )
    ("org-assets"
     :base-directory "."
     :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
     :publishing-directory ,publish-dir
     :recursive t
     :publishing-function org-publish-attachment)
    ))

(org-publish "org" t)
(delete-directory "./publish/publish" t)

(defun pub ()
  "Publish org-project \"org\""
  (interactive)
  (org-publish-project "org")
  (delete-directory (concat publish-dir (file-name-as-directory "publish")) t))

Any help is appreciated! Thanks!

  • 1
    Just for reference: the org-publish-cache feature was introduced on orgmode mail list by Sebastian Rose. – skovorodkin Aug 19 at 2:41
  • 1
    @skovorodkin Thanks for the information! – Xin Huang Aug 19 at 23:11
3

I'm new to answering on StackExchange, so if I'm doing something wrong I'm sorry, and any advice is welcome!

This is probably a bug, but this is a temporary solution I have found :). I ran this on Emacs 26.1, org-mode 9.2 on Ubuntu 18.04. Unfortunately I didn't manage to find the bug, but maybe this will be easier to use in the meantime.

This is what I did (I tried it twice):

  1. I changed org mode titles in 2 different files and tried to force publish the project. Eventually the sitemap wouldn't update, even after a forced org-publish.
  2. Then I removed the timestamps using the function below and force published again.
(org-publish-remove-all-timestamps)
(org-publish "your-project-name" t)

tl;dr - Suggestion: Sometimes it's best to search for functions / variables in Emacs.

Emacs has A LOT of functions / variables etc. I used to search for most of my answers using Google, but when it comes to Emacs, sometimes the best way to find what I needed was just to search in Emacs itself. These days I start with Google and if I can't find what I need quickly, I move to searching through variables / functions / etc. inside Emacs itself. Spacemacs makes this really easy thanks to its focus on Discoverability. There are simply keyboard shortcuts to search for functions / variables, etc. You could add them to your setup even if you don't use Spacemacs. Here is the link to the Github documentation about Discoverability in Spacemacs.

Discoverability in Spacemacs - Github Link

  • It's not a bug, it's a feature :) org-publish caches all titles to speed up sitemap generation. The author probably didn't think users would want to change titles very often. – skovorodkin Aug 19 at 2:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.