DEV Community

Cover image for Setting up Hugo with Enwrite
Özgür Dinç
Özgür Dinç

Posted on • Originally published at ozgurodun.com

Setting up Hugo with Enwrite

TLDR; First post here and new to blogging, telling how to setup my new blog with hugo.

Hi,
This will be first post here, i don't like writing much but seeing people post on dev.to and sharing experiences made me think about writing what i like and what i do. Hope you'll enjoy.
First post will be about setting up my new site.

Story Part

I had this domain ozgurodun.com for a long time, i tried to setup blogs a few time, but never commit any content. As i said before i am a lazy person when it comes to writing. After dev.to opened i read a lot of developers posts (Many thanks to Ben and Jess for this great platform) and start thinking about sharing. So i decide to setup a blog one more time. This time i will write at least once a month :)

Technology

For a long time i wanted to setup a static web site. For this i am using Hugo, fastest framework for building static websites.
Hugo
Hugo is easy to deploy and fast but in the end i didnt want to go in cli or using git webhooks for adding new posts. So i searched a bit and found enwrite . This will work as a cms for my site. Enwrite syncs up with evernote account and searches for specific notebook and "published" tag then fetches those notes as markdown files or html files to your public directory.
I will use a debian installed vps and glue all this together.

Setup

Hugo

At first i started by installing hugo, which has a ton of documentation here. I didnt mess with building from source so i downloaded the deb here
install and build a new site:

$ dpkg -i hugo_0.30.2_Linux-64bit.deb
$ hugo new site my_site_name
Enter fullscreen mode Exit fullscreen mode

This will create a new site template( folders and basic configuration files ). And $ hugo server -D will start a server to use in testing. and -D option will build draft files too.

Theme

After this i go to Hugo Themes and choose "introduction theme". Installing themes are pretty easy too.
Just create a directory named "themes" in your new my_site_name directory and

$ git clone https://github.com/hivickylai/hugo-theme-introduction.git introduction
Enter fullscreen mode Exit fullscreen mode

Every hugo themes have different feature some have builtin support for disqus, some are designed minimal, some are for portfolios some are for one page cvs. You can choose what fits you better. Thanks to Vicky Lai she prepared an example site in this repository and i setup my site looking at her example config file. I played with setting and make some little changes in layout files. I win a cookie by the way when looking in codes. Thanks :)
Vicky Lai's cookie

Enwrite

To install enwrite i needed to apt-get install rubygems, then :

$ gem install enwrite
Enter fullscreen mode Exit fullscreen mode

Installation is easy but after playing with enwrite a little bit i realised last commit to enwrite was 3 years ago and after that hugo had many updates. So easy enwrite is not compatible with latest hugo. After hesitating a little i decided to clone the enwrite repository and fix the issue. Luckily code was documented well, and the fix is really small; i changed and build enwrite. And made my first pull request if zzamboni accepts :D (Better late than never).

$ enwrite -n my_notebook -t published -o ~/my_new_site
Enter fullscreen mode Exit fullscreen mode

This searches notes tags "published" in "my_notebook" in evernote and outputs them to my_new_site folder.
For tests i write a few "lorem ipsum" posts, and run enwrite command with "--rebuild_all"

Cron

Finally i made two cron jobs, one for hugo and one for enwrite and every five minutes they will search for new note and build to public folder.

Final

This is basicly how i setup my blog. If you have any questions you can ask in comments section.
Have a nice day!! :D

Top comments (0)