Hugo๋กœ github.io ๋ธ”๋กœ๊ทธ ๋งŒ๋“ค๊ธฐ

๋ธ”๋กœ๊ทธ ์˜ฎ๊ฒผ์Šต๋‹ˆ๋‹ค! ๐Ÿก’ integer.blog

์ฃผ์†Œ๊ฐ€ github.io์ธ ๊ฐœ๋ฐœ ๋ธ”๋กœ๊ทธ๋“ค์ด ๋ˆˆ์— ๋งŽ์ด ๋„์—ˆ๋‹ค.
์ฐพ๋‹ค๋ณด๋‹ˆ Jekyll, Hexo, Hugo ๋“ฑ Static Site Generator์˜ ์กด์žฌ๋ฅผ ์•Œ๊ฒŒ ๋˜์—ˆ๋‹ค.
Hugo์™€ Github Page์˜ ์กฐํ•ฉ์œผ๋กœ Devlog๋กœ ์‚ฌ์šฉํ•  ๊ฐœ์ธ ๋ธ”๋กœ๊ทธ๋ฅผ ๋งŒ๋“ค๊ธฐ๋กœ ํ–ˆ๋‹ค.
๋†€๋‹ค ์ง€์นœ ์—ฌ๋ฆ„ํœด๊ฐ€ ๋ง‰๋ฐ”์ง€์— ์ง‘์ค‘๊ณต๋žต์„ ์‹œ์ž‘!

0. ๋ชฉ์ฐจ

1. Static Site Generator ๋ž€?
2. Static Site Generator ์„ ํƒ ๊ณผ์ •
3. Hugo, ๋„ˆ๋กœ ์ •ํ–ˆ๋‹ค!
4. Hugo + Github Page ๋งŒ๋“œ๋Š” ๊ณผ์ •
5. ๋Œ“๊ธ€ ์œ„์ ฏ ์ถ”๊ฐ€ํ•˜๊ธฐ (Utterances ์‚ฌ์šฉ)
6. ์‚ฌ์šฉ ํ›„๊ธฐ (๊ณ„์† ์ถ”๊ฐ€ ์˜ˆ์ •)

1. Static Site Generator ๋ž€?

์ด ๊ธ€์ด ์ •์  ์›น์‚ฌ์ดํŠธ ์ƒ์„ฑ๊ธฐ์™€ ๋™์  ์›น์‚ฌ์ดํŠธ ์ƒ์„ฑ๊ธฐ์˜ ์ฐจ์ด๋ฅผ ์ž˜ ์„ค๋ช…ํ•ด์ฃผ๊ณ  ์žˆ๋‹ค.

2. Static Site Generator ์„ ํƒ ๊ณผ์ •

์ด ๊ณณ์—์„œ ๋ชจ๋“ (?) Static Site Generator๋“ค์„ ํ•œ๋ˆˆ์— ๋ณผ ์ˆ˜ ์žˆ์—ˆ๋‹ค.
์ด ๊ธ€์—์„œ ๊ฐ€์žฅ ๋งŽ์ด ์‚ฌ์šฉํ•˜๋Š” Jekyll , Hexo, Hugo๋ฅผ ๋น„๊ตํ•˜์—ฌ ์•„๋ž˜ ๋‚ด์šฉ์„ ์ฐธ๊ณ ํ•˜์˜€๋‹ค.

Jekyll
  -๋ฃจ๋น„ ๊ธฐ๋ฐ˜
  -ํ˜„์žฌ ๊ฐ€์žฅ ์ธ๊ธฐ ์žˆ์Œ(๊นƒํ—™ ๋ณ„ ์ˆ˜ ์ œ์ผ ๋งŽ์Œ)
  -ํ•œ๊ธ€ ๋ ˆํผ๋Ÿฐ์Šค๋„ ์ œ์ผ ๋งŽ์Œ
  -๋Š๋ฆฌ๋‹ค๋Š” ์ œ๋ณด๊ฐ€ ๋งŽ์Œ(๋ช‡ ์‹ญ๊ฐœ์˜ ํฌ์ŠคํŒ… ๋ฟ์ธ๋ฐ๋„ ๋นŒ๋“œ ํ•˜๋Š”๋ฐ 5๋ถ„์”ฉ ๊ฑธ๋ฆฐ๋‹ค๊ณ )
  -์œˆ๋„์šฐ ๊ณต์‹ ์ง€์› ์•ˆ๋จ

Hexo
  -์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ(Node.js) ๊ธฐ๋ฐ˜
  -ํ•œ๊ธ€ ๋ ˆํผ๋Ÿฐ์Šค ๊ฝค ๋งŽ์Œ
  -๋ฉ”์ธ ๊ฐœ๋ฐœ์ž๊ฐ€ ์†์„ ๋†“์€ ๋“ฏ
  -๊ฐœ๋ฐœ์ž๊ฐ€ ์ค‘๊ตญ์ธ? ์ด๋ผ ๊ตฌ๊ธ€๋งํ•˜๋ฉด ์ค‘๊ตญ์–ด ๊ธ€์ด ๋งŽ์ด ๋‚˜์˜ด

Hugo
  -Golang ๊ธฐ๋ฐ˜
  -๋นŒ๋“œ ๋น ๋ฆ„
  -๋ฌธ์„œํ™” ์ž˜๋ผ์žˆ์Œ
  -๊นƒํ—™ ๋ณ„ ์ˆ˜๊ฐ€ ํ—ฅ์†Œ๋ณด๋‹ค ๋งŽ์Œ
  -ํ•œ๊ธ€ ๋ ˆํผ๋Ÿฐ์Šค๊ฐ€ ๊ฑฐ์˜ ์—†์Œ

์ถœ์ฒ˜: http://tadakichi.tistory.com/188

3. Hugo, ๋„ˆ๋กœ ์ •ํ–ˆ๋‹ค!

3.1. ๋‚ด๊ฐ€ Hugo๋ฅผ ์„ ํƒํ•œ ์ด์œ 

  • Go๋กœ ์ œ์ž‘๋˜์—ˆ๋‹ค. (Go๋ฅผ ๊ณต๋ถ€์ค‘์ด๋‹ค.)
  • Hugo๋Š” ๋Ÿฐํƒ€์ž„์— ๋‹ค๋ฅธ ์˜์กด์„ฑ์ด ํ•„์š”ํ•˜์ง€ ์•Š์•„ ๋นŒ๋“œ์‹œ๊ฐ„์ด ์„ธ๊ณ„์—์„œ ์ œ์ผ ๋น ๋ฅด๋‹ค. (“Hugo is the worldโ€™s fastest static website engine.”)
  • ์˜คํ”ˆ์†Œ์Šค์— ๊ธฐ์—ฌํ•  ๊ธฐํšŒ !! (Hugo๋Š” ํ•œ๊ธ€ Reference๊ฐ€ ๊ฑฐ์˜ ์—†๋Š” ์˜คํ”ˆ์†Œ์Šค์ด๋ฉฐ Jekyll์— ๋น„ํ•ด ๊ธฐ์—ฌํ•  ์ˆ˜ ์žˆ๋Š” ์—ฌ์ง€๊ฐ€ ๋‚จ์•„์žˆ๋‹ค.)

3.2. CloudZ Labs์—์„œ Github Page์™€ ํ™˜์ƒ์˜ ์กฐํ•ฉ์ธ Jekyll ๋Œ€์‹  Hugo๋ฅผ ์„ ํƒํ•œ ์ด์œ 

  • “Jekyll์„ ์‚ฌ์šฉํ•  ๊ฒฝ์šฐ, ๋ณ„๋„์˜ Build ๊ณผ์ • ์—†์ด Repository์— Push๋งŒ์œผ๋กœ ์ž‘์„ฑํ•œ ๊ธ€๋“ค์ด ์•Œ์•„์„œ Publishing๋ฉ๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ, ๊ธ€์ด ๋งŽ์•„์งˆ ์ˆ˜๋ก Jekyll์˜ ๋นŒ๋“œ ์„ฑ๋Šฅ์€ ํ˜„์ €ํ•˜๊ฒŒ ์ €ํ•˜๋ฉ๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ, Hugo๋Š” Build ๊ณผ์ •์ด ์žˆ์–ด๋„ ์„ฑ๋Šฅ์ €ํ•˜ ์—†์ด, ๋น ๋ฅด๊ฒŒ ๊ธ€์„ Publishingํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Go๋‚˜ ๊ธฐํƒ€ ์ข…์†์„ฑ ์—†์ด, Hugo CLI๋ฅผ ํ†ตํ•ด์„œ ์‰ฝ๊ฒŒ ๋ธ”๋กœ๊ทธ ๋ฐ ๊ธ€์„ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ, Hugo๋กœ ๋ธ”๋กœ๊ทธ๋ฅผ ๋งŒ๋“ค๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.”

4. Hugo + Github Page ๋งŒ๋“œ๋Š” ๊ณผ์ •

4.1. Hugo ์„ค์น˜

๋‚˜๋„ ๋ฉ‹๊น”๋‚˜๊ฒŒ $ brew install hugo๋ฅผ mac ํ„ฐ๋ฏธ๋„์— ์ž…๋ ฅํ•ด์„œ ์„ค์น˜ํ•˜๊ณ  ์‹ถ์—ˆ๋‹ค.
ํ•˜์ง€๋งŒ ํ˜„์‹ค์€ WINDOWS…
Giraffe Academy์˜ Windows์—์„œ Hugo์„ค์น˜ํ•˜๊ธฐ ์ด ์˜์ƒ ํ•˜๋‚˜๋ฉด ์„ค์น˜๋Š” ์‰ฝ๋‹ค.

  • hugo ๊ณต์‹ ๊นƒํ—™์—์„œ ์šด์˜์ฒด์ œ์— ๋งž๋Š” ์ตœ์‹ ๋ฒ„์ „ ๋‹ค์šด๋กœ๋“œ
  • C:\Hugo\bin ๋””๋ ‰ํ† ๋ฆฌ ์ƒ์„ฑํ•ด์„œ ๋‹ค์šด๋ฐ›์€ ์••์ถ•ํŒŒ์ผ ํ•ด์ œ
  • ์–ด๋Š ์œ„์น˜์—์„œ๋‚˜ Hugo๊ฐ€ ์‹คํ–‰๋  ์ˆ˜ ์žˆ๋„๋ก$ set PATH=%PATH%;C:\Hugo\bin ๋ช…๋ น์œผ๋กœ ํ™˜๊ฒฝ๋ณ€์ˆ˜์— C:\Hugo\bin์ถ”๊ฐ€
  • ๋ช…๋ น ํ”„๋กฌํ”„ํŠธ์— $ hugo version ํ˜น์€ $ hugo help๋กœ ๋™์ž‘ ํ™•์ธ

4.2. Github ์ €์žฅ์†Œ 2๊ฐœ ๋งŒ๋“ค๊ธฐ

  • ํ•˜๋‚˜๋Š” Hugo์˜ ์ปจํ…์ธ ์™€ ์†Œ์ŠคํŒŒ์ผ๋“ค์„ ํฌํ•จํ•  <YOUR-PROJECT> ์ €์žฅ์†Œ ์ƒ์„ฑ (๋‚˜์˜ ๊ฒฝ์šฐ blog๋ผ๋Š” ์ด๋ฆ„์œผ๋กœ ์ƒ์„ฑ)
  • ๋‹ค๋ฅธ ํ•˜๋‚˜๋Š” ๋ Œ๋”๋ง๋œ ๋ฒ„์ „์˜ Hugo ์›น์‚ฌ์ดํŠธ๋ฅผ ํฌํ•จํ•  <USERNAME>.github.io ์ €์žฅ์†Œ ์ƒ์„ฑ (integerous.github.io)

4.3. Directory Structure ๊ตฌ์„ฑ

  • $ hugo new site blog ๋ช…๋ น์œผ๋กœ ๋กœ์ปฌ์—์„œ ์ปจํ…์ธ ๋ฅผ ๊ด€๋ฆฌํ•˜๊ธฐ ์œ„ํ•œ ์žฅ์†Œ(Hugo/blog) ์ƒ์„ฑ
  • C:\Hugo\blog์—์„œ $ dir๋กœ directory structure๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.

4.4. ํ…Œ๋งˆ ๋‹ค์šด๋กœ๋“œ ๋ฐ ์„ค์ •

  • https://themes.gohugo.io/ ์—์„œ ์›ํ•˜๋Š” ํ…Œ๋งˆ๋ฅผ ์„ ํƒํ•œ๋‹ค.
  • ์„ ํƒํ•œ ํ…Œ๋งˆ์˜ github์—์„œ ์ €์žฅ์†Œ ์ฃผ์†Œ๋ฅผ ๋ณต์‚ฌํ•œ๋‹ค.
  • C:\Hugo\blog\themes์— ์„ ํƒํ•œ ํ…Œ๋งˆ๋ฅผ cloneํ•œ๋‹ค. $ git clone https://github.com/์„ ํƒํ•œ/ํ…Œ๋งˆ
  • config.toml ํŒŒ์ผ์„ ์„ ํƒํ•œ ํ…Œ๋งˆ์˜ ์„ค๋ช…์„œ์— ๋”ฐ๋ผ ์ˆ˜์ •ํ•œ๋‹ค.

4.5. Remote์™€ Submodule ์„ค์ •

  • ๊นƒํ—™์— ๋งŒ๋“  blog ์ €์žฅ์†Œ๋ฅผ local์˜ blog ๋””๋ ‰ํ† ๋ฆฌ์˜ remote๋กœ ๋“ฑ๋กํ•œ๋‹ค.
    • C:\Hugo\blog ๋กœ ์ด๋™
    • $ git init
    • $ git remote add origin git@github.com:integerous/blog.git
  • integerous.github.io ์ €์žฅ์†Œ๋ฅผ blog์˜ submodule๋กœ ๋“ฑ๋กํ•œ๋‹ค.
    • $ git submodule add -b masater git@github.com:integerous/integerous.github.io.git public
    • ์ด๋ ‡๊ฒŒ ํ•จ์œผ๋กœ์จ hugo ๋ช…๋ น์œผ๋กœ public์— ์›น์‚ฌ์ดํŠธ๋ฅผ ๋งŒ๋“ค ๋•Œ, ๋งŒ๋“ค์–ด์ง„ public ๋””๋ ‰ํ† ๋ฆฌ๋Š” ๋‹ค๋ฅธ remote origin์„ ๊ฐ€์งˆ ๊ฒƒ์ด๋‹ค.

4.6. ์ปจํ…์ธ  ์ƒ์„ฑ

  • $ hugo new post/test1.md ๋ช…๋ น์œผ๋กœ ํŒŒ์ผ์„ ์ƒ์„ฑํ•˜๋ฉด \content\post\test1.md
  • ์ปจํ…์ธ ๊ฐ€ ์–ด๋–ป๊ฒŒ ๋ณด์—ฌ์ง€๋Š”์ง€ ํ™•์ธํ•˜๋ ค๋ฉด
    • $ hugo server ํ˜น์€ $ hugo server -D๋กœ ์›น์„œ๋ฒ„ ์‹คํ–‰
    • http://localhost:1313/์— ์ ‘์†ํ•ด์„œ ํ™•์ธ
    • -D ์˜ต์…˜์€ draft ๋ฌธ์„œ๋“ค๋„ ๋ณด์—ฌ์ง€๋Š” ์˜ต์…˜. ๋‹ค๋ฅธ ์˜ต์…˜์€ ์—ฌ๊ธฐ์—์„œ ํ™•์ธ

4.7. ์ปจํ…์ธ  ์—…๋กœ๋“œ (๋ธ”๋กœ๊ทธ์—)

  • C:\Hugo\blog๋กœ ์ด๋™
  • $ hugo -t ํ…Œ๋งˆ์ด๋ฆ„ ๋ช…๋ น์„ ํ†ตํ•ด ํ…Œ๋งˆ๊ฐ€ ์ ์šฉ๋œ ๋ธ”๋กœ๊ทธ ๋‚ด์šฉ์„ public์— ์ƒ์„ฑํ•œ๋‹ค.
  • $ cd public public ๋””๋ ‰ํ† ๋ฆฌ๋กœ ์ด๋™ํ•˜์—ฌ
  • $ git add . ์ˆ˜์ •๋œ ํŒŒ์ผ๋“ค์„ index์— ์˜ฌ๋ฆฐ๋‹ค.
  • $ git commit -m "์ปค๋ฐ‹๋ฉ”์„ธ์ง€" ๋ณ€๊ฒฝ ๋‚ด์šฉ์„ commitํ•˜๊ณ 
  • $ git push origin master commit์„ Integerous.github.io์— ํ‘ธ์‹œ
  • blog ์ €์žฅ์†Œ์—๋„ ๋ณ€๊ฒฝ๋‚ด์šฉ ํ‘ธ์‹œ
    • $ git add .
    • $ git commit -m "์ปค๋ฐ‹๋ฉ”์„ธ์ง€"
    • $ git push origin master

4.8. ์‰˜ ์Šคํฌ๋ฆฝํŠธ๋กœ ์—…๋กœ๋“œ ์ž๋™ํ™”ํ•˜๊ธฐ

  • Hugo Docs์˜ deploy.sh ํŒŒ์ผ์„ ํ™œ์šฉํ•˜์—ฌ ์‰˜์Šคํฌ๋ฆฝํŠธ ์ž‘์„ฑ
    #!/bin/bash
    
    echo -e "\033[0;32mDeploying updates to GitHub...\033[0m"
    
    # Build the project.
    hugo -t hugo-theme-geppaku
    
    # Go To Public folder
    cd public
    # Add changes to git.
    git add .
    
    # Commit changes.
    msg="rebuilding site `date`"
    if [ $# -eq 1 ]
      then msg="$1"
    fi
    git commit -m "$msg"
    
    # Push source and build repos.
    git push origin master
    
    # Come Back up to the Project Root
    cd ..
    
    
    # blog ์ €์žฅ์†Œ Commit & Push
    git add .
    
    msg="rebuilding site `date`"
    if [ $# -eq 1 ]
      then msg="$1"
    fi
    git commit -m "$msg"
    
    git push origin master

5. Utterences (Github ๋Œ“๊ธ€ ์œ„์ ฏ) ์ถ”๊ฐ€ํ•˜๊ธฐ

์•„์›ƒ์‚ฌ์ด๋”๋‹˜์˜ ๋ธ”๋กœ๊ทธ ๊ธ€์—์„œ Utterences์˜ ์กด์žฌ๋ฅผ ์•Œ๊ฒŒ ๋˜์—ˆ๋‹ค.
Hugo ๊ณต์‹ ๋ฌธ์„œ์— ์†Œ๊ฐœ๋œ ๋Œ“๊ธ€ ์œ„์ ฏ ์ค‘ Utterences๋Š” ์—†๊ธธ๋ž˜ ์ƒ์•  ์ฒ˜์Œ์œผ๋กœ ์˜คํ”ˆ์†Œ์Šค์— PR์„ ๋‚ ๋ ค๋ด„!

5.1. Hugo Docs์—์„œ ๋‚ด Pull Request ๋ฐ›์•„์คŒ!!!

์ƒ์•  ์ฒซ ์˜คํ”ˆ์†Œ์Šค ๊ธฐ์—ฌ! (๋งค์šฐ ์†Œ์†Œํ•œ ๊ธฐ์—ฌ์ง€๋งŒ.. ์˜คํ”ˆ์†Œ์Šค์— ๊ธฐ์—ฌํ•˜๊ธฐ ์‹œ์ž‘ํ–ˆ๋‹ค๋Š” ์‚ฌ์‹ค๋งŒ์œผ๋กœ ํ–„๋ณถ!)

5.2. ์ž‘๋™ ์›๋ฆฌ

Utterance ํ”„๋กœ์ ํŠธ์˜ ์ž‘๋™ ๋ฐฉ์‹์„ ์†Œ๊ฐœํ•˜์ž๋ฉด,
Github์˜ ์ด์Šˆ ๊ฒ€์ƒ‰ API๋ฅผ ์‚ฌ์šฉํ•ด์„œ ๊ฐ ๊ธ€์— ํ•ด๋‹นํ•˜๋Š” ์ด์Šˆ๊ฐ€ ์ƒ์„ฑ๋˜๊ณ (์ตœ์ดˆ ๋Œ“๊ธ€ ์ž‘์„ฑ ์‹œ),
๋Œ“๊ธ€๋“ค์€ ํ•ด๋‹น ๊ธ€๋กœ ์ƒ์„ฑ๋œ ์ด์Šˆ์— ๋Œ€ํ•œ ๋Œ“๊ธ€๋กœ ์ถ”๊ฐ€๋˜๋Š” ๋ฐฉ์‹์ด๋‹ค. ๋Œ“๊ธ€์€ Primer๋ฅผ ์ด์šฉํ•ด์„œ Github ์Šคํƒ€์ผ๋กœ ๋ณด์—ฌ์ง„๋‹ค.

5.3. ์‚ฌ์šฉ ๋ฐฉ๋ฒ•

  1. Github์— public ์ €์žฅ์†Œ๋ฅผ ๋งŒ๋“ค๊ณ (blog-comments ๋“ฑ์œผ๋กœ)
  2. Utterance document์—์„œ ๋ฐฉ๊ธˆ ๋งŒ๋“  ์ €์žฅ์†Œ๋ฅผ ์ž…๋ ฅํ•˜๊ณ (๋‚˜์˜ ๊ฒฝ์šฐ Integerous/blog-comments)
  3. ๋ธ”๋กœ๊ทธ ๊ธ€๊ณผ Github ์ด์Šˆ๋ฅผ ๋งคํ•‘ํ•  ๋ฐฉ๋ฒ• 6๊ฐ€์ง€ ์ค‘ ํ•œ ๊ฐ€์ง€๋ฅผ ์„ ํƒํ•˜๋ฉด
  4. ๋ฐ‘์— ์•„๋ž˜์™€ ๊ฐ™์€ script๋ฅผ ์ž๋™์œผ๋กœ ์ƒ์„ฑํ•ด์ค€๋‹ค.
    <script src="https://utteranc.es/client.js"
            repo="integerous/blog-comments"
            issue-term="pathname"
            crossorigin="anonymous"
            async>
    </script>
    
  5. ์œ„์˜ script๋ฅผ ๋ณธ์ธ์˜ ๋ธ”๋กœ๊ทธ ํ…œํ”Œ๋ฆฟ์ค‘ ์›ํ•˜๋Š” ์œ„์น˜์— ๋„ฃ์œผ๋ฉด
  6. ๋!

6. ์‚ฌ์šฉ ํ›„๊ธฐ (๊ณ„์† ์ถ”๊ฐ€๋  ์˜ˆ์ •)

6.1. ๋งˆํฌ๋‹ค์šด ํŒŒ์ผ์— Gist ์‚ฝ์ž…ํ•˜๊ธฐ

Gist๋Š” ๋งˆํฌ๋‹ค์šด ํŒŒ์ผ์— embed ๋˜์ง€ ์•Š๋Š”๋‹ค. ํ•˜์ง€๋งŒ Hugo, Jekyll ์—์„œ๋Š” ๊ฐ€๋Šฅํ•˜๋‹ค.

6.1.1. Gist ์ƒ์„ฑ

  • Gist์— ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑ
  • java ์ฝ”๋“œ๋ฉด ํŒŒ์ผ๋ช…์„ ํŒŒ์ผ๋ช….java๋กœ ๋งŒ๋“ค๊ณ  Create public gist ํด๋ฆญ
  • ์ƒ์„ฑ๋˜๋Š” gist์˜ sha1 hash(url ๋๋ถ€๋ถ„)์„ ๋ณต์‚ฌ

6.1.2. Hugo์— ์ปค์Šคํ…€ shorcodes ์ƒ์„ฑ

๊ฐ„๋‹จํ•œ ์„ค๋ช…์€ ์—ฌ๊ธฐ ์ฐธ๊ณ .
์ž์„ธํ•œ ์‚ฌ์šฉ๋ฒ•์€ ์ด ํŠœํ† ๋ฆฌ์–ผ ์˜์ƒ ์ฐธ๊ณ 

  • themes/๋ณธ์ธํ…Œ๋งˆ/layouts ๋””๋ ‰ํ† ๋ฆฌ์— shortcodes ํด๋”๋ฅผ ์ƒ์„ฑ
  • shortcodes ํด๋” ๋‚ด์— gist.html ํŒŒ์ผ ์ƒ์„ฑ (ํŒŒ์ผ๋ช…์€ ์ƒ๊ด€์—†์ง€๋งŒ gist๋กœ ํ•˜๋Š”๊ฒŒ ์ •์ฒด์„ฑ์ด ๋ถ„๋ช…ํ•จ)
  • gist.html์— ์•„๋ž˜ ์ฝ”๋“œ ์ž…๋ ฅ
<script type="text/javascript" src="http://gist.github.com/{{ .Get 0 }}.js"></script>
  • ์—ฌ๊ธฐ์„œ {{ . GET 0 }}์— ๋“ค์–ด๊ฐˆ ๋ถ€๋ถ„์ด ์œ„์—์„œ ๋ณต์‚ฌํ•ด๋‘” ๊ฐ gist์˜ sha1 hash(url ๋๋ถ€๋ถ„)์ด๋‹ค.

6.1.3. shortcode ์‚ฝ์ž…

  • ๊ธ€ ๋‚ด์šฉ ์ค‘ ์ฝ”๋“œ๊ฐ€ ๋“ค์–ด๊ฐˆ ๋ถ€๋ถ„์— {{< gist url๋๋ถ€๋ถ„ >}} ์„ ๋„ฃ์–ด์ฃผ๋ฉด,

gistExample

  • ์œ„ ์ฒ˜๋Ÿผ ๋งˆํฌ๋‹ค์šด ํŒŒ์ผ(.md)์—๋„ gist๋ฅผ ์‚ฝ์ž…ํ•  ์ˆ˜ ์žˆ๋‹ค. (ํ–‰๋ณต)

*๋ธ”๋กœ๊ทธ ์ฃผ์†Œ

https://ryan-han.com

*Reference