emacs/var/elfeed/db/data/0c/0c16297bff59b24ae93c195cb1ec42c921cb8d37
2022-01-03 12:49:32 -06:00

1 line
3.8 KiB
Plaintext

<!-- SC_OFF --><div class="md"><p>I was following this helpful video from System Crafters (<a href="https://youtu.be/AfkrzFodoNw">https://youtu.be/AfkrzFodoNw</a>).</p> <p>The only thing that I had some troubles was to export my org-roam <code>ID</code> links. </p> <p>Tinkering a little with the <code>build-site.el</code> from the video, I did some changes to make it work. </p> <p>I want to share with the community if anyone find it useful. </p> <pre><code>;; Set the package installation directory so that packages aren&#39;t stored in the ;; ~/.emacs.d/elpa path. (require &#39;package) (setq package-user-dir (expand-file-name &quot;./.packages&quot;)) (setq package-archives &#39;((&quot;melpa&quot; . &quot;https://melpa.org/packages/&quot;) (&quot;elpa&quot; . &quot;https://elpa.gnu.org/packages/&quot;) (&quot;org&quot; . &quot;https://orgmode.org/elpa/&quot;))) ;; Initialize the package system (package-initialize) ;; (unless package-archive-contents ;; (package-refresh-contents)) (package-refresh-contents) ;; ;; Install dependencies (package-install &#39;htmlize) (package-install &#39;org) (package-install &#39;org-roam) ;; Load the publishing system (require &#39;ox-publish) (require &#39;org-roam) (setq org-roam-directory (file-truename &quot;./content&quot;)) (setq org-id-link-to-org-use-id t) ;; (org-roam-db-autosync-mode) (setq org-id-extra-files (org-roam-list-files)) (defun org-html--reference (datum info &amp;optional named-only) &quot;Return an appropriate reference for DATUM. DATUM is an element or a `target&#39; type object. INFO is the current export state, as a plist. When NAMED-ONLY is non-nil and DATUM has no NAME keyword, return nil. This doesn&#39;t apply to headlines, inline tasks, radio targets and targets.&quot; (let* ((type (org-element-type datum)) (user-label (org-element-property (pcase type ((or `headline `inlinetask) :CUSTOM_ID) ((or `radio-target `target) :value) (_ :name)) datum)) (user-label (or user-label (when-let ((path (org-element-property :ID datum))) (concat &quot;ID-&quot; path))))) (cond ((and user-label (or (plist-get info :html-prefer-user-labels) ;; Used CUSTOM_ID property unconditionally. (memq type &#39;(headline inlinetask)))) user-label) ((and named-only (not (memq type &#39;(headline inlinetask radio-target target))) (not user-label)) nil) (t (org-export-get-reference datum info))))) ;; Customize the HTML output (setq org-html-validation-link nil ;; Don&#39;t show validation link org-html-head-include-scripts nil ;; Use our own scripts org-html-head-include-default-style nil ;; Use our own styles org-html-head &quot;&lt;link rel=\&quot;stylesheet\&quot; href=\&quot;https://cdn.simplecss.org/simple.min.css\&quot; /&gt;&quot;) ;; (setq org-link-search-must-match-exact-headline nil) ;; (setq org-id-track-globally t) ;; Define the publishing project (setq org-publish-project-alist (list (list &quot;org-site:main&quot; :recursive nil :exclude &quot;.*dir-locals\.el|.*gitignore|*.gitmodules|.*/gtd/.*|.*/dailies/.*&quot; :base-directory &quot;./content&quot; :publishing-function &#39;org-html-publish-to-html :publishing-directory &quot;./public&quot; :with-author nil ;; Don&#39;t include author name :with-creator t ;; Include Emacs and Org versions in footer :with-toc t ;; Include a table of contents :section-numbers nil ;; Don&#39;t include section numbers :time-stamp-file nil :auto-sitemap t))) (setq org-export-with-broken-links &#39;mark) ;; Generate the site output (org-publish-all t) (message &quot;Build complete!&quot;) </code></pre> </div><!-- SC_ON --> &#32; submitted by &#32; <a href="https://www.reddit.com/user/mklsls"> /u/mklsls </a> <br/> <span><a href="https://www.reddit.com/r/emacs/comments/q82zci/how_to_include_the_id_links_into_your_orgroam/">[link]</a></span> &#32; <span><a href="https://www.reddit.com/r/emacs/comments/q82zci/how_to_include_the_id_links_into_your_orgroam/">[comments]</a></span>