bsdnerds logo

Hexo on OpenBSD

Hexo can be used for blogging op OpenBSD. Hexo converts your markdown files into a html blog, similar to mkdocs, hugo, pelican and others. Besides static blogs, there are lots of programming languages and tools available like Python, PHP, nginx and others on the BSDs.

However, if you want to create a static blog hexo is one of the tools you can use for that. Hexo lets you write your blog articles in markdown, then convert the output to static html. It comes with all kinds of plugins and themes you can use to tweak your static blog.

Of course, you can wonder if the security compromise is necessary for something like blogging. Hexo requires node and npm. Do you really need random npm packages for blogging?

Eitherway, it is entirely possible to create a blog with Hexo. If you already have a blog, it may be to cumbersome to convert everything to something else. It should work on other BSD systems too like FreeBSD or NetBSD. On FreeBSD you can do this in a jail.

Hexo static blog generator on OpenBSD

Install Hexo on OpenBSD

First install node and npm on your OpenBSD box. Then run the commands below to install hexo and be able to use it from your OpenBSD system.

mkdir ~/.npm
npm config set prefix ~/.npm
nano ~/.bashrc
export PATH="$PATH:$HOME/.npm/bin"
npm install hexo -g

Then run the command

export PATH=~/.npm-global/bin:$PATH

Finally you can run the hexo command.

foo$ hexo
Usage: hexo <command>

  help     Get help on a command.
  init     Create a new Hexo folder.
  version  Display version information.

Global Options:
  --config  Specify config file instead of using _config.yml
  --cwd     Specify the CWD
  --debug   Display all verbose messages in the terminal
  --draft   Display draft posts
  --safe    Disable all plugins and scripts
  --silent  Hide output on console

For more help, you can use 'hexo help [command]' for the detailed information
or you can check the docs:

If you don’t have a blog already, then you can start like this:

hexo init blog
cd blog
npm install
hexo server

It’s also possible to generate your blog from markdown using a bash script, if you want to go very secure and minimal.

Jules Mon, 5 Jan 2021

Thanks, have been searching for hours for this

Frank Mon, 5 Jan 2021

No problem, glad to help