Jekyll
Wed, 09 May 2018 09:05:00 +0700
jekyll
สำหรับสร้าง static site จาก Markdown(kramdown) หรือ Liquid templates
- Jekyll เขียนด้วย Ruby แต่คนใช้ไม่ต้องแตะมันเลยถ้าไม่ต้องเขียนปลั๊กอิน
- ง่าย เร็ว สะดวก ไม่มี database
- ทำ Blog ส่วนตัว เว็บบริษัท ที่ไม่ต้องการ Access Control
- แก้ Template ง่าย
ลง
คอนฟิก
File: _config.yaml
markdown: kramdown
theme: minima
highlighter: rouge
show_excerpts: true
excerpt_separator: "<!--more-->"
compress_html:
clippings: all
comments: ["<!-- ", " -->"]
endings: all
blanklines: false
File: _layouts/default.html เพิ่ม layout: compress ใน frontmatter เพื่อให้ jekyll-compress-html ทำงาน
---
layout: compress
---
<!DOCTYPE html>
<html lang="th_TH">
...
เขียน
รันบน localhost พร้อม livereload สำหรับใช้เขียนหรือปรับแต่งเว็บและรวมบทความที่อยู่ใน _drafts/
jekyll serve --livereload --drafts
สร้าง
สั่งให้ jekyll สร้างเว็บสำหรับ production
JEKYLL_ENV=production jekyll build
อัพโหลด
อัพโหลดด้วยคำสั่ง rsync โดยใช้ checksum ของไฟล์
rsync -v -rz --checksum --delete _site/ user@host:/var/www/html/xxx/