An open API service indexing awesome lists of open source software.

https://github.com/kaushalmodi/noxhugo

Utility to build Hugo sites using ox-hugo (Emacs + Org mode)
https://github.com/kaushalmodi/noxhugo

cli emacs git hugo nim org-mode

Last synced: 3 months ago
JSON representation

Utility to build Hugo sites using ox-hugo (Emacs + Org mode)

Awesome Lists containing this project

README

          

#+title: noxhugo
#+author: Kaushal Modi

Utility for generating Hugo sites using ox-hugo (Emacs + Org mode).

-----
*!ALERT! This project is in very Alpha stage. Feel free to
read/review/comment on the Nim code.*

Ignore this alert.. just try out Nim! :)
-----

* What?
- [[https://gohugo.io][What is Hugo?]]
- [[https://ox-hugo.scripter.co/][What is ~ox-hugo~?]]
* Noxhugo Sub-commands
~noxhugo~ has the following sub-commands:
- ~init~
- ~help~
** ~noxhugo init~

This command should be used only for the *first time init* of a site.

1. Checks if ~hugo~ and ~git~ binaries are present in the ~PATH~.
2. Checks if the ~hugo~ version is "new enough".
- If it's not new enough, the error thrown will be helpful.
3. Runs ~hugo new site SITENAME~.
- The SITENAME is provided by the user using the "-d" switch.
4. Deletes ~archetypes~ directory from the site as it's useless in the
~ox-hugo~ flow.
5. Clones the following theme and theme component repos:
- Main theme -- https://github.com/kaushalmodi/hugo-bare-min-theme
- Theme component -- https://github.com/kaushalmodi/hugo-search-fuse-js
- Theme component -- https://github.com/kaushalmodi/hugo-debugprint

You are free to change these themes later.
6. Updates the site config with some sane defaults, setting the theme
to ~hugo-bare-min-theme~, etc.
7. Generates a "starter" ~site.org~ Org content file.
8. Git commits all of the above as the first commit.

After that command, you can open that ~site.org~ file in Emacs and
(assuming that you already have the ~ox-hugo~ package installed and
set up) export it using ~C-c C-e H A~. That will export posts from all
subtrees in that file to the ~content/~ directory.
*** Command
#+begin_example
noxhugo init -d foo
#+end_example

If the directory name specified with the "-d" switch already exists,
~hugo~ will not generate a new site.

In that case, you have a brute-force option -- to delete an existing
site if any and create a new one from scratch.

*WARNING! You will lose all content in that directory! It is deleted
entirely including its git history!*

With that, here's how you would force-delete an existing site to
create a new one in its place:
#+begin_example
noxhugo init -d foo -F
#+end_example
* Help
Show help for all sub-commands:
#+begin_example
noxhugo help
#+end_example

Show help only for a given sub-command {X}:
#+begin_example
noxhugo {X} -h
#+end_example
* TODO [0/1]
- [ ] Add ~noxhugo gen~ command so that site is generated using emacs
batch mode.
- Useful for site generation on CI/CD so that user needss to commit
just the Org files.
- Useful for non-Emacs users who just like Org mode.
* Development
** Dependency for building
~nim~ built from [[https://github.com/nim-lang/Nim/tree/devel][~devel~ branch]].
** Building
[[https://github.com/nim-lang/nimble][~nimble~]] is used to build this project. This utility ships with Nim
installation. Think of it as the equivalent of ~pip~ in Python.

With Nim/~nimble~ installed, do:
#+begin_example
git clone https://github.com/kaushalmodi/noxhugo
cd noxhugo
nimble build # creates the noxhugo binary in the git repo root dir
#+end_example
** Installing
If you want to install it (will build the binary and copy it to
=~/.nimble/bin/=), do:
#+begin_example
# cd to the git repo dir
nimble install
#+end_example

/You need to have added =~/.nimble/bin/= to your ~PATH~ environment
variable.

* COMMENT Local Variables :ARCHIVE:
# Local Variables:
# fill-column: 70
# eval: (auto-fill-mode 1)
# End: