I showed you my source code, pls respond
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
2.8 KiB

4 years ago
4 years ago
4 years ago
4 years ago
  1. #+TITLE: Hugo
  2. #+AUTHOR: Christopher James Hayward
  3. #+EMAIL: chris@chrishayward.xyz
  4. #+PROPERTY: header-args:emacs-lisp :tangle hugo.el :comments org
  5. #+PROPERTY: header-args :results silent :eval no-export :comments org
  6. #+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil
  7. #+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil
  8. Create entire websites with Emacs.
  9. * Setup
  10. Download and install ~hugo~[fn:1] on your system before loading the module:
  11. #+begin_src shell
  12. RUN apt install -y hugo
  13. #+end_src
  14. * Config
  15. It's possible to export ~org-mode~ into ~hugo~[fn:1] specific markdown[fn:2] using the ~ox-hugo~[fn:3] package. I have my setup configured for one-post-per-file, despite it not being the suggested method. The option will appear in the default export menu inside of an ~org-mode~ buffer, accessible by pressing =C-c C-e=.
  16. #+begin_src emacs-lisp
  17. (use-package ox-hugo
  18. :after ox)
  19. #+end_src
  20. * Shortcuts
  21. Create capture templates for creating new blog posts, and creating publicly shared notes on various topics, and other peoples published works.
  22. ** Posts
  23. I post nonsense on my personal blog, available here[fn:4]. This template makes sure the file ends up going to the right location, with the configuration pre-applied.
  24. #+begin_src emacs-lisp
  25. (with-eval-after-load 'org-roam
  26. (add-to-list 'org-roam-capture-templates
  27. '("p" "Post" plain (function org-roam-capture--get-point)
  28. "%?"
  29. :file-name "docs/posts/${slug}"
  30. :unnarrowed t
  31. :head
  32. "
  33. ,#+TITLE: ${title}
  34. ,#+AUTHOR: Christopher James Hayward
  35. ,#+DATE: %<%Y-%m-%d>
  36. ,#+OPTIONS: num:nil todo:nil tasks:nil
  37. ,#+EXPORT_FILE_NAME: ${slug}
  38. ,#+ROAM_KEY: https://chrishayward.xyz/posts/${slug}/
  39. ,#+HUGO_BASE_DIR: ../
  40. ,#+HUGO_AUTO_SET_LASTMOD: t
  41. ,#+HUGO_SECTION: posts
  42. ,#+HUGO_DRAFT: true
  43. ")))
  44. #+end_src
  45. ** Notes
  46. Read my notes on various textbooks, artciles, and other un-categorized nonsense here[fn:5]. This template makes sure the file ends up going to the right location, with the configuration pre-applied.
  47. #+begin_src emacs-lisp
  48. (with-eval-after-load 'org-roam
  49. (add-to-list 'org-roam-capture-templates
  50. '("n" "Notes" plain (function org-roam-capture--get-point)
  51. "%?"
  52. :file-name "docs/notes/${slug}"
  53. :unnarrowed t
  54. :head
  55. "
  56. ,#+TITLE: ${title}
  57. ,#+AUTHOR: Christopher James Hayward
  58. ,#+OPTIONS: num:nil todo:nil tasks:nil
  59. ,#+EXPORT_FILE_NAME: ${slug}
  60. ,#+ROAM_KEY: https://chrishayward.xyz/notes/${slug}/
  61. ,#+HUGO_BASE_DIR: ../
  62. ,#+HUGO_AUTO_SET_LASTMOD: t
  63. ,#+HUGO_SECTION: notes
  64. ,#+HUGO_DRAFT: true
  65. ")))
  66. #+end_src
  67. * Footnotes
  68. [fn:1] https://gohugo.io
  69. [fn:2] https://markdownguide.org/tools/hugo
  70. [fn:3] https://github.com/kaushalmodi/ox-hugo
  71. [fn:4] https://chrishayward.xyz/posts/
  72. [fn:5] https://chrishayward.xyz/notes/