:PROPERTIES: :ID: 7d2e867e-f091-4362-a583-453f732207fe :END: #+title: emacs-stuff-org-publish #+filetags: :org:notes: * How to insert footnotes: The Org website[fn:1] now looks a lot better than it used to. [fn:1] The link is: https://orgmode.org * Resources: https://ogbe.net/blog/blogging_with_org https://systemcrafters.net/publishing-websites-with-org-mode/building-the-site/ https://orgmode.org/manual/Publishing-options.html https://www.orgroam.com/manual.html#Configuration https://www.reddit.com/r/emacs/comments/1j7febh/my_static_website_is_generated_from_org_mode_and/?chainedPosts=t3_116yit2 https://orgmode.org/worg/org-tutorials/org-publish-html-tutorial.html https://taingram.org/blog/org-mode-blog.html https://karthinks.com/software/emacs-window-management-almanac/ https://gongzhitaao.org/orgcss/ https://ogbe.net/blog/emacs_org_static_site https://edwardtufte.github.io/tufte-css/ https://zilongli.org/code/org-tufte-example * Extra snippets of code: #+begin_src emacs-lisp ;; Commented out things: ;; (defvar z-head ;; " ;; ") ;; (setq org-html-validation-link nil ;; org-html-head-include-scripts nil ;; org-html-head-include-default-style nil ;; org-html-head z-head) ;; (type-of (car '(rose violet daisy buttercup))) ;; (cadr (assoc "FILETAGS" (org-collect-keywords '("FILETAGS")))) ;; (let ((list '(("post1.org") ("post2.org")))) ;; (mapconcat (lambda (entry) ;; (format "- [[file:%s]]" (car entry))) ;; list ;; "\n")) ;; ("website" ;; :components ("org-main" "org-categories-sitemap" "org-assets" "org-posts" "org-blogs" "org-static")) ;; :html-head " ;; ;; ;; ;; " (defun z/write-tag-pages () "Generate tags/*.org pages listing posts for each tag." (let* ((site-root (expand-file-name "~/master-folder/org_files/org_web/")) (tags-dir (expand-file-name "tags" site-root))) (unless (file-directory-p tags-dir) (make-directory tags-dir t)) (let ((idx (z/gather-tag-index))) (maphash (lambda (tag items) (let* ((slug (z/tag-slug tag)) (outfile (expand-file-name (format "%s.org" slug) tags-dir))) (with-temp-file outfile (insert (format "#+TITLE: Tag: %s\n#+OPTIONS: toc:nil num:nil title:nil \n\n* Posts tagged %s\n" tag tag)) ;; sort newest first if DATE present (setq items (sort items (lambda (a b) (string> (nth 2 a) (nth 2 b))))) (dolist (it items) (let* ((file (nth 0 it)) (title (nth 1 it)) (rel (file-relative-name file tags-dir))) ;; link to the source .org; org-publish will rewrite to the .html (insert (format "- [[file:%s][%s]]\n" rel title))))))) idx) ;; Also write an index page listing all tag pages ;; (let* ((all ())) ;; (maphash (lambda (tag _items) (push tag all)) (z/gather-tag-index)) ;; (with-temp-file (expand-file-name "index.org" (expand-file-name "tags" site-root)) ;; (insert "#+TITLE: All Tags\n#+OPTIONS: toc:nil num:nil\n\n* Tags\n") ;; (dolist (tag (sort all #'string-lessp)) ;; (insert (format "- [[file:%s.org][%s]]\n" (z/tag-slug tag) tag))))) ))) #+end_src * Options stuff: In Org mode, you can control per-file publishing behavior using special keywords (known as **file-local metadata**) at the top of the file. These are written like: ```org #+KEYWORD: value ``` --- Here are **useful options** you can set **per file**: | Keyword | Purpose | | -------------------- | ----------------------------------------------------- | | `#+TITLE:` | Title of the document | | `#+AUTHOR:` | Author name | | `#+EMAIL:` | Email address | | `#+DATE:` | Date | | `#+OPTIONS:` | Control export behavior (e.g. toc, num, author, etc.) | | `#+HTML_HEAD:` | Custom HTML for `` (like styles or scripts) | | `#+HTML_HEAD_EXTRA:` | Extra HTML inserted in `` | | `#+HTML_PREAMBLE:` | Whether to include the preamble (`t`, `nil`, or HTML) | | `#+HTML_POSTAMBLE:` | Same but for postamble | | `#+LANGUAGE:` | Language used for export | | `#+DESCRIPTION:` | Adds a `` tag | | `#+KEYWORDS:` | Adds a `` tag | --- ### ✅ Example: Disable TOC and Section Numbers *for one file* You can use the `#+OPTIONS:` line like so: ```org #+OPTIONS: toc:nil num:nil ``` This disables the Table of Contents and section numbers **just for that file**. Your updated file might look like this: #+BEGIN_SRC emacs-lisp #+TITLE: Welcome to My Org Website #+OPTIONS: toc:nil num:nil #+HTML_HEAD: #+HTML_HEAD: #+END_SRC Here's a reference for some values you can tweak via `#+OPTIONS:`: | Option | Meaning | Example | | ------------- | -------------------------------- | ---------------- | | `toc:` | Table of contents (`t` or `nil`) | `toc:nil` | | `num:` | Section numbering | `num:nil` | | `author:` | Show author name | `author:nil` | | `creator:` | Show Emacs/Org creator info | `creator:nil` | | `date:` | Show date | `date:nil` | | `html-style:` | Disable default style | `html-style:nil` |