Build

Intro

  • 휴고를 이용하여 정적사이트로 빌드하고, 로컬서버에서 확인하는 과정을 간단히 살펴봅니다.
  • 자세한 내용은 Guide 섹션에서 확인할 수 있습니다.

빌드

프로젝트 시작

  • 터미널에서 다음의 명령을 입력하여 Hugo 프로젝트를 생성합니다.
hugo new site DocFlow_web
PS D:\PlayGround> hugo new site DocFlow_web
Congratulations! Your new Hugo site was created in D:\PlayGround\DocFlow_web.
Just a few more steps...
1. Change the current directory to D:\PlayGround\DocFlow_web.
2. Create or install a theme:
   - Create a new theme with the command "hugo new theme <THEMENAME>"
   - Or, install a theme from https://themes.gohugo.io/
3. Edit hugo.toml, setting the "theme" property to the theme name.
4. Create new content with the command "hugo new content <SECTIONNAME>\<FILENAME>.<FORMAT>".
5. Start the embedded web server with the command "hugo server --buildDrafts".
See documentation at https://gohugo.io/.
  • DocFlow_web 폴더로 이동하여 깃을 초기화 합니다.
cd DocFlow_web
git init
PS D:\PlayGround> cd DocFlow_web
PS D:\PlayGround\DocFlow_web> git init
Initialized empty Git repository in D:/PlayGround/DocFlow_web/.git/
PS D:\PlayGround\DocFlow_web>
  • Hextra 테마를 추가합니다.
git submodule add https://github.com/imfing/hextra.git themes/hextra
PS D:\PlayGround\DocFlow_web> git submodule add https://github.com/imfing/hextra.git themes/hextra
Cloning into 'D:/PlayGround/DocFlow_web/themes/hextra'...
remote: Enumerating objects: 3140, done.
remote: Counting objects: 100% (1425/1425), done.
remote: Compressing objects: 100% (492/492), done.
Receiving objects:   2% (63/3140), 428.00 KiB | 840.00 Receiving objects:   3% (95/3140), 428.00 KiB | 840.00
...
Resolving deltas: 100% (1932/1932), done.
warning: in the working copy of '.gitmodules', LF will be replaced by CRLF the next time Git touches it
PS D:\PlayGround\DocFlow_web>

초기 설정

  • DocFlow 폴더를 DocFlow_web 폴더의 content 폴더로 복사합니다.
  • DocFlow_web 폴더의 hugo.toml 파일을 노트패드나 VS Code 등의 편집기를 이용하여 다음과 같이 편집한 후 저장합니다.
baseURL = 'https://example.org/'
languageCode = 'en-us'
title = 'DocFlow'
theme = "hextra"
  
[[menu.main]]
  name = "DocFlow"
  url = "/docflow/about/intro"
  weight = 1

확인

  • 터미널에서 hugo server 를 실행하여 로컬로 빌드합니다.
PS D:\PlayGround\DocFlow_web> hugo server
Watching for changes in D:\PlayGround\DocFlow_web\{archetypes,assets,content,data,i18n,layouts,static,themes}
Watching for config changes in D:\PlayGround\DocFlow_web\hugo.toml
Start building sites 
...
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop
  • 크롬등의 브라우저의 주소창에 http://localhost:1313를 입력합니다.

tutorial_compt.png