reddit / emacs

Yet another blog setup based on Emacs & Org Mode

aimebertrand · 2022-06-23 20:19
Emacs, Hugo, GitLab and this Blog or How I write my blog without leaving Org Mode [https://macowners.club/posts/emacs-hugo-gitlab-blog/](https://macowners.club/posts/emacs-hugo-gitlab-blog/)
danderzei · 2022-06-23 20:26
There is no need for ox-hugo as Hugo parses org mode natively
aimebertrand · 2022-06-23 21:17
Wait, what? Show me! I didn't follow. I this a new thing? Went right by me.
kaushalmodi · 2022-06-23 22:31
You don't need to use `ox-hugo` if the Go Org parser is adequate for your post content, and also you prefer the per-file export flow. From your post: > Now of course there some rules you need to follow. The first one being selecting either the “One post per Org subtree” or the “One post per Org file” strategy. > I use the later. For some reason the first option did not work for me. Even if you don't use the per-subtree flow, please open an issue with a minimum reproducible example if you can. If that turns out to a bug, it will get fixed and help others. --- Here's the obligatory [Why ox-hugo?](https://ox-hugo.scripter.co/doc/why-ox-hugo/) doc on why it exists even when Hugo supports basic Org mode syntax natively.
kaushalmodi · 2022-06-23 22:59
Some more feedback on your post: > has to be in the root directory of the Hugo site. Just to clarify, the Org mode files to be exported by `ox-hugo` can be anywhere, but not in one of the Hugo component directories like `content` or `layout`. So the best place for that directory would be in the git root of that site's repository. Some people may choose to have the Hugo built sites and the Org source in completely different repos. > `#+HUGO_BASE_DIR: ../` > `#+HUGO_SECTION: posts` You can set these in a `.dir-locals.el` instead. > `#+HUGO_WEIGHT: auto` This doesn't apply much to per-file export flow. > `#+EXPORT_FILE_NAME:` This isn't necessary. The Org file base name will be used by default. > I enable this per org file by adding the following at the bottom of the file. With an added benefit of being able to use other Emacs (Lisp) variables within this syntax. Have a look at `.dir-locals.el` instead. Then you won't need to append the file local variables section at the end of each Org file. [Example from my blog source](https://gitlab.com/kaushalmodi/kaushalmodi.gitlab.io/-/blob/master/.dir-locals.el).
danderzei · 2022-06-24 02:29
Here is one I prepared earlier https://lucidmanager.org/productivity/create-websites-with-org-mode-and-hugo/
pxoq · 2022-06-24 03:01
If I recall Hugo generates the HTML differently if its org (due to the go org parser generating it differently?) and not markdown. For example their is a nice hugo theme called [paperesque](https://github.com/capnfabs/paperesque) that has these javascript enabled sidenotes. It works for markdown files but not org since the generated selectors are different. Maybe they changed this? This was like a year ago I tried this.
danderzei · 2022-06-24 03:18
The site I linked is fully written in plain Org. I did design my own theme though. There are a few quirks that can be smoothed out with some functions, which is what I am working on. I'll try that theme with my set up tonight and see what it does.
danderzei · 2022-06-24 09:20
The theme seems to work fine. Not sure what the sidenotes are - I can't see them on the example site.
Trio_tawern_i_tkwisz · 2022-06-24 10:32
Cool thing about using ox-hugo is that I can easly separate note metadata from actual article content. I'm not saying that without ox-hugo it's not possible, just that is quite ecplicit in doc's how to do it.
aimebertrand · 2022-06-24 11:22
>Even if you don't use the per-subtree flow, please open an issue with a minimum reproducible example if you can. If that turns out to a bug, it will get fixed and help others. I will look into it and open issue in the case that I can reproduce my problem of the beginning of course. However I am not entirely sure I even remember which it was as I mentioned in the post.
aimebertrand · 2022-06-24 11:28
>You can set these in a .dir-locals.el instead. > >\[...\] > >Have a look at .dir-locals.el instead. Then you won't need to append the file local variables section at the end of each Org file. Example from my blog source. Brilliant. The less "clutter" in the blog file, the better. ​ >Just to clarify, the Org mode files to be exported by ox-hugo can be anywhere, but not in one of the Hugo component directories like content or layout. > >\[...\] > >This doesn't apply much to per-file export flow. > >\[...\] > >This isn't necessary. The Org file base name will be used by default. Will update the post to reflect the feedback a soon as I can. P.S.: Thank you, both for the package and the notes here.
404cn · 2022-06-28 11:29
It's base on Emacs & Org Mode & Hugo.