YASnippets


Although i've moved this over to hugo and everything is written in org i still havent found a way that suits me to create new posts, i know various things are available such as ox-hugo etc but nothing had so far clicked for me. So after using YASnippets for work related notes i realised this would work for me when creating a new post

so now when i type hugo and press [TAB] i get the following

#+TITLE: 
#+AUTHOR: drakxtwo
#+EMAIL: 
#+DESCRIPTION: 
#+LANGUAGE:  en
#+TAGS: [""]
#+DATE: 2019-02-02T12:47:40

The template for YASnippet looks like;

# -*- mode: snippet -*-
# name: hugo
# key: hugo
# --

#+TITLE: 
#+AUTHOR: drakxtwo
#+EMAIL: 
#+DESCRIPTION: 
#+LANGUAGE:  en
#+TAGS: [""]
#+DATE: `(format-time-string "%Y-%m-%dT%H:%M:%S" (current-time))`

Though in the creation of this post i realised that the new template system (as it comes in org 9.2) does not work nicely with hugo. The above are actually wrapped in;

#+BEGIN_SRC python

#+END_SRC

to make them render correctly and if i did not do that then for example press [C-c C-, a] gives the template for ascii which looks like

#+begin_export ascii
#+end_export

looks ok yes? but when hugo interprets this section it becomes invisible on the rendered website if you view the raw source of this page you can see below that the text is there just not shown through the browser and to get the output visible i had to capitalise the template

#+TITLE: #+AUTHOR: drakxtwo #+EMAIL: #+DESCRIPTION: #+AUTHOR: #+MAILTO: #+KEYWORDS: #+LANGUAGE: en #+DATE: 2019-02-02T12:47:40 #+TAGS: [""]

like this;

#+BEGIN_EXPORT ASCII

#+END_EXPORT

but then this gives a not very nice output eg;

#+TITLE: #+AUTHOR: drakxtwo #+EMAIL: #+DESCRIPTION: #+AUTHOR: #+MAILTO: #+KEYWORDS: #+LANGUAGE: en #+DATE: 2019-02-02T12:47:40 #+TAGS: [""]

i guess i'm going to have to invest more time into either resolving this or using ox-hugo and co still it was an interesting output of the change brought about by org 9.2.

emacs  org  hugo 

See also