Setting up Hugo with Enwrite
Tags: go, hugo, blog, tutorial
Published: 2017-11-02 19:39:47

---
title: Setting up Hugo with Enwrite
published: true
description: 
tags: #go, #hugo, #blog, #tutorial
cover_image: https://thepracticaldev.s3.amazonaws.com/i/azdua40wqpw19xsi466k.png
canonical_url: https://ozgurodun.com/blog/first-post/
---
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](https://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](https://gohugo.io), fastest framework for building static websites.
![Hugo](https://thepracticaldev.s3.amazonaws.com/i/0l3jm5fsnqbg8k9ozk1p.png)
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 ] (https://github.com/zzamboni/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](https://gohugo.io/documentation). I didnt mess with building from source so i downloaded the deb [here](https://github.com/gohugoio/hugo/releases)
install and build a new site:
```
$ dpkg -i hugo_0.30.2_Linux-64bit.deb
$ hugo new site my_site_name
```
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](https://themes.gohugo.io/) 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
```
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](https://vickylai.io/) 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](https://thepracticaldev.s3.amazonaws.com/i/6gyzofozzhehdid1j2jl.png)

### Enwrite
To install enwrite i needed to apt-get install rubygems, then :
```
$ gem install enwrite
```
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
```
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