2023-09-12 – Quarto Blog 만들기

Author

최규빈

Published

September 12, 2023

0. 꼭 해야할까?

1. https://www.youtube.com/watch?v=SZcjvjrdomE

  • repo도 확인함
  • commit 은 거의 기본임

2. https://www.youtube.com/watch?v=Yc56NpYW1DM&t=23s

  • 3:00 - 3:40: 깃헙과 블로그가 중요함 / commit 을 빼곡하게, repo 확인
  • 3:40 - : 블로그
  • 4:00 - : commit 링크가 없으면 X, 필수라고 해서 넣은 느낌 (영상에서는 필수 아니라고 하지만 반 필수임)

1. 블로그 생성

- 깃헙레포지토리로 이동한뒤에 아래의 명령어를 입력:

quarto create-project --type website --template blog

위의 명령어를 실행하면 여러가지 설정파일들이 생성된다.

- 블로그 publish

quarto publish gh-pages

- 깃헙으로 이동하여 확인

  • window는 자동으로 퍼블리쉬 된다.
  • mac에서는 수동으로 gh-pages로 바꿔야함.

2. 새로운 포스트 생성

- 아무 노트북이나 만들어본다. (혹은 이미 만들어진 노트북을 넣어본다.)

- 노트북을 posts 폴더에 넣는다.

- 아래를 통하여 preview 이미지를 확인.

quarto preview 

- 퍼블리쉬

quarto publish --no-prompt

3. 블로그 설정변경

- index.qmd 메인에 보이는 화면

---
title: "기계학습활용 (2023)"
listing:
  contents: posts
  sort: "date"
  type: table
  categories: true
  sort-ui: false
  filter-ui: false
page-layout: full
title-block-banner: false
---

**질문하는 방법**

- 카카오톡: [질문하러 가기](http://pf.kakao.com/_skxnxdG/chat) // 학기종료이후 폐쇄함
- 이메일: <guebin@jbnu.ac.kr>
- 직접방문: 자연과학대학 본관 205호 
- Zoom: *카카오톡이나 이메일로 미리 시간을 정할 것*
- LMS쪽지: <https://ieilms.jbnu.ac.kr/>

**references**

**공지사항** 

- 강의영상의 경우 시간이 지나면 고화질로 시청할 수 있습니다. (인코딩중에는 유튜브에서 저화질로 송출됩니다)
- **9월7일 대면수업**: Quarto를 이용한 기술블로그 만들기 + 타이타닉 자료에 대한 발표/토론 

**강의노트** 

- _quarto.yml

project:
  type: website

website:
  title: "MP2023"
  navbar:
    right:
      - icon: github    
        href: https://github.com/guebin/MP2023
      - icon: youtube
        href: https://www.youtube.com/channel/UCQk9RyBNgXc7ORIsYlOfQrg/playlists?view=50&sort=dd&shelf_id=2
format:
  html:
    theme: cosmo
    css: styles.css

- posts 폴더에서 _metadata.yml

# options specified here will apply to all posts in this folder

# freeze computational output
# (see https://quarto.org/docs/projects/code-execution.html#freeze)
execute:
  freeze: auto  # re-render only when source changes

# Enable banner style title blocks
title-block-banner: false

notebook-links: true
cap-location: margin
reference-location: margin
citation-location: margin

format:
  html:
    toc: true
    code-fold: false
    code-line-numbers: false
    code-copy: true
  ipynb: default

- 기타 자세한 옵션은 아래에서 뒤져볼 것

- 다른 사람들의 블로그 소개 (설정파일 구경용)

4. 이해

- 아래를 입력

git add .
git commit -m .
git switch gh-pages
  • 폴더내용 확인

- 다시 원래대로 돌아오기

git switch main

- quarto publish 의 역할

  • .ipynb 파일을 어떠한 규칙에 따라 변환하여 .html파일로 바꿈
  • 바꾼 파일들을 gh-pages라는 이름의 브랜치로 옮김
  • gh-pages 브랜치를 github 으로 push
  • 이후에는 github이 알아서 gh-pages의 내용을 웹이 뿌려줌.

- 블로그가 깨졌을때 대응하는 방법

  • gh-pages로 이동하여 모든 파일 및 폴더 삭제
  • git add ., git commit -m . git push를 순서대로 입력
  • 다시 main으로 돌아와서 quarto publish --no-prompt 입력

5. 추천하는 루틴

git add .
git commit -m .
git push 
quarto publish --no-prompt