Convenience functions for my new jekyll blog

This commit is contained in:
Emmet 2023-11-20 17:16:15 -06:00
parent d2fa34df57
commit d7b549a94c
2 changed files with 37 additions and 0 deletions

View file

@ -529,6 +529,23 @@ same directory as the org-buffer and insert a link to this file."
(add-hook 'org-mode-hook #'org-transclusion-mode)
(defun org-jekyll-new-post ()
(interactive)
(setq new-blog-post-title (read-from-minibuffer "Post name: "))
(setq new-blog-post-slug (downcase (replace-regexp-in-string "[^[:alpha:][:digit:]_-]" "" (string-replace " " "-" new-blog-post-title))))
(setq new-blog-post-file (concat (projectile-project-root) "org/_posts/" (format-time-string "%Y-%m-%d") "-" new-blog-post-slug ".org"))
(let ((org-capture-templates
`(("p" "New Jekyll blog post" plain (file new-blog-post-file)
,(concat "#+title: " new-blog-post-title "\n#+options: toc:nil num:nil\n#+begin_export: html\n---\nlayout: post\ntitle: " new-blog-post-title "\nexcerpt: %?\ntags: \npermalink: " new-blog-post-slug "\n---\n#+end_export\n")))
)) (org-capture))
)
(map! :leader
:prefix ("N")
:desc "New blog post"
"p" #'org-jekyll-new-post)
;;;------ Org roam configuration ------;;;
(require 'org-roam)
(require 'org-roam-dailies)

View file

@ -648,6 +648,26 @@ exit
(add-hook 'org-mode-hook #'org-transclusion-mode)
#+END_SRC
*** Org Jekyll
#+begin_src emacs-lisp :tangle config.el
(defun org-jekyll-new-post ()
(interactive)
(setq new-blog-post-title (read-from-minibuffer "Post name: "))
(setq new-blog-post-slug (downcase (replace-regexp-in-string "[^[:alpha:][:digit:]_-]" "" (string-replace " " "-" new-blog-post-title))))
(setq new-blog-post-file (concat (projectile-project-root) "org/_posts/" (format-time-string "%Y-%m-%d") "-" new-blog-post-slug ".org"))
(let ((org-capture-templates
`(("p" "New Jekyll blog post" plain (file new-blog-post-file)
,(concat "#+title: " new-blog-post-title "\n#+options: toc:nil num:nil\n#+begin_export: html\n---\nlayout: post\ntitle: " new-blog-post-title "\nexcerpt: %?\ntags: \npermalink: " new-blog-post-slug "\n---\n#+end_export\n")))
)) (org-capture))
)
(map! :leader
:prefix ("N")
:desc "New blog post"
"p" #'org-jekyll-new-post)
#+end_src
** Org Roam Configuration
*** Standard Org Roam Configuration
#+BEGIN_SRC emacs-lisp :tangle config.el