|
|
#+TITLE: Hugo #+AUTHOR: Christopher James Hayward #+EMAIL: chris@chrishayward.xyz
#+PROPERTY: header-args:emacs-lisp :tangle hugo.el :comments org #+PROPERTY: header-args :results silent :eval no-export :comments org
#+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil #+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil
Create entire websites with Emacs.
* Setup
Download and install ~hugo~[fn:1] on your system before loading the module:
#+begin_src shell RUN apt install -y hugo #+end_src
* Config
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=.
#+begin_src emacs-lisp (use-package ox-hugo :after ox) #+end_src
* Shortcuts
Create capture templates for creating new blog posts, and creating publicly shared notes on various topics, and other peoples published works.
** Posts
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.
#+begin_src emacs-lisp (with-eval-after-load 'org-roam (add-to-list 'org-roam-capture-templates '("p" "Post" plain (function org-roam-capture--get-point) "%?" :file-name "docs/posts/${slug}" :unnarrowed t :head " ,#+TITLE: ${title} ,#+AUTHOR: Christopher James Hayward ,#+DATE: %<%Y-%m-%d>
,#+OPTIONS: num:nil todo:nil tasks:nil
,#+EXPORT_FILE_NAME: ${slug} ,#+ROAM_KEY: https://chrishayward.xyz/posts/${slug}/
,#+HUGO_BASE_DIR: ../ ,#+HUGO_AUTO_SET_LASTMOD: t ,#+HUGO_SECTION: posts ,#+HUGO_DRAFT: true "))) #+end_src
** Notes
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.
#+begin_src emacs-lisp (with-eval-after-load 'org-roam (add-to-list 'org-roam-capture-templates '("n" "Notes" plain (function org-roam-capture--get-point) "%?" :file-name "docs/notes/${slug}" :unnarrowed t :head " ,#+TITLE: ${title} ,#+AUTHOR: Christopher James Hayward
,#+OPTIONS: num:nil todo:nil tasks:nil ,#+EXPORT_FILE_NAME: ${slug} ,#+ROAM_KEY: https://chrishayward.xyz/notes/${slug}/
,#+HUGO_BASE_DIR: ../ ,#+HUGO_AUTO_SET_LASTMOD: t ,#+HUGO_SECTION: notes ,#+HUGO_DRAFT: true "))) #+end_src
* Footnotes
[fn:1] https://gohugo.io
[fn:2] https://markdownguide.org/tools/hugo
[fn:3] https://github.com/kaushalmodi/ox-hugo
[fn:4] https://chrishayward.xyz/posts/
[fn:5] https://chrishayward.xyz/notes/
|