• 2022.09.08 - 링크 수정, 오타 수정

Install

  • ubuntu 에서 패키지로 설치
$ sudo apt install hugo
$ hugo version

Create a New SIte

$ hugo new site my_site -f yml

Add a Theme

  • 설치와 설정에 대한 자세한 사항은 hugo papermod를 참고.

  • PaperMod 테마 설치
    $ cd my_site
    $ git clone https://github.com/adityatelange/hugo-PaperMod themes/PaperMod --depth=1
    
  • Update
    $ cd themes/PaperMod
    $ git pull
    
  • Add theme set in config.yml
$ echo 'theme: "PaperMod"' >> config.yml
  • 또는 PaperMod 홈에 가서 config.yml을 복사한다.

Sample Page 만들기

---
title: "My 1st post"
date: 2020-09-15T11:30:03+00:00
# weight: 1
# aliases: ["/first"]
tags: ["first"]
author: "Me"
# author: ["Me", "You"] # multiple authors
showToc: true
TocOpen: false
draft: false
hidemeta: false
comments: false
description: "Desc Text."
canonicalURL: "https://canonical.url/to/page"
disableHLJS: true # to disable highlightjs
disableShare: false
disableHLJS: false
hideSummary: false
searchHidden: true
ShowReadingTime: true
ShowBreadCrumbs: true
ShowPostNavLinks: true
ShowWordCount: true
ShowRssButtonInSectionTermList: true
UseHugoToc: true
cover:
	image: "<image path/url>" # image path/url
	alt: "<alt text>" # alt text
	caption: "<text>" # display caption under cover
	relative: false # when using page bundles set this to true
	hidden: true # only hide on current single page
editPost:
	URL: "https://github.com/<path_to_repo>/content"
	Text: "Suggest Changes" # edit text
	appendFilePath: true # to append file path to Edit link
---
## This is sample Page

Hello World!
  • 페이지 생성1: my_site/contents/sample.md가 들어간다.
$ hugo new --kind post sample.md
  • 페이지 생성2: my_site/contents/posts/my-first-post.md가 생성된다.
$ hugo new posts/my-first-post.md

LANGUAGE CODE 설정

  • my_site/langcode.yaml 을 추가하고 설정한다.
- id: prev_page
  translation: "Prev"

- id: next_page
  translation: "Next"

- id: read_time
  translation:
    one: "1 min"
    other: " min"

- id: words
  translation:
    one: "word"
    other: " words"

- id: toc
  translation: "Table of Contents"

- id: translations
  translation: "Translations"

- id: home
  translation: "Home"

- id: edit_post
  translation: "Edit"

- id: code_copy
  translation: "copy"

- id: code_copied
  translation: "copied!"

Start the Hugo Server

  • 아래와 같이 서버를 실행하고 브라우저에서 http://localhost:1313 으로 확인
  • 실행 위치는 my_site/ 내에서 해야한다.
$ hugo server -D