---title:{{.Name | time.Format .Site.Params.DateFormat }}# DataFormatで指定した形式の日時がタイトルになるdate:{{.Date }}# hugo new でmdファイルを作成したときの日時が入るcategories:"日報"draft:falsescore:# 0 ~ 10 # 自分で定義した変数---
記事のフロントマター
---title:""date:{{.Date }}categories:["記事"]draft:falseshowtoc:true# 目次を表示するかどうか(使用しているhugoのテーマ"PaperMod"で定義されている変数)tocopen:true# ページをロードした時に目次を開いた状態にするかどうか(使用しているhugoのテーマ"PaperMod"で定義されている変数)description:""tags:[]cover:image:""# image path/urlalt:""# alt textcaption:""# display caption under coverrelative:false# when using page bundles set this to truehidden:true# only hide on current single page---
#!/bin/bash
score_regex='^score: (10|[0-9])'
# daily-reports以下のmdファイルにscoreを0-10で指定していることをチェックする
is_can_commit=true
for file in $(git diff --name-only --cached | grep 'content/daily-reports/.*\.md$'); do
line=$(awk 'NR==7' "$file")
if [[ !("$line" =~ $score_regex) ]]; then
is_can_commit=false
echo "$file にscoreが0-10で指定されていないよ"
fi
done
if ! $is_can_commit; then
echo "日報のmdファイルにscoreを指定してからコミットしてください"
exit 1
fi