A bit of everyday hugo commands
Table of Contents
I’m using Hugo as blog engine. So, here is a bit of cli commands
Create new post
hugo new post/postname.md
Formatting in summary
By default summary is plain text, soo.. just use <!--mоre-->
and formatting will work in summary.
I’m going to make most of posts just only summary, maybe I can change hugo code, to add <!--mоre-->
automatically?
Lets try..
Yes, I can change archetypes/default.md
.
And I also want draft to be false by default.. here we go:
---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: false
---
<!--mоre-->
Btw: I used Cyrillic ‘o’ in ‘more’, otherwise it breaks layout. Maybe there is better solution, but I do not think I will need to talk about <!--mоre-->
again any time soon.
Publish post
- Go to post header section (top of .md file)
- Remove
draft: true
or replace it withdraft:false
Run locally
hugo server -D
Will run hugo server in “development” mode, draft blogs are visible
hugo server
will run it in “release” mode
Deploy
- We need 2 repositories:
– One is our root repository with themes and all raw data
– Subproject liked to
%blogname%.github.io
- So
git add %ssh.link.to.blogname.project.on.github% public
hugo
command will compile static html content topublic
foldercd public && git add . && git commit -m 'whatever' && git push
Also: README.md has a priority over index.html, so, remove it if you had added it during project creation.