以下のコマンドでプレビューできます。
npm run watch
http://localhost:8000/
デフォルトでは8000ポートを利用しますが、環境変数を使ってポート番号を上書きできます。
PORT=8001 npm run watch
./data/
以下にマークダウンファイルを入稿します。
ファイル冒頭を ---
でくくると変数を指定できます。
title
と url
と published
が必須です。
url
は出力先になります。
published
は index ファイルがソートするのに利用します。
次のような内容で、 data/sample_article.md
などに保存すると http://localhost:8000/sample_article
でアクセスできるようになります。
---
title: sample article
url: /sample_article
published: 2024/03/18 00:00
---
トップレベル見出しは `title` 変数が利用されます。
変えたい場合は template/default.html を修正してください。
## サンプル記事
これはサンプル記事です。ブログ開始のときに削除してください。
## マークダウン
記事は、マークダウン記法で記述し、 `.md` ファイルで保存してください。
リンクは次のように記述します。
[アンカーテキストはこちら](http://example.com)
リストは次のように記述します。
* リスト1
* リスト2
* リスト3
画像は、 `data/image/` 以下に配置して、パスを指定してください。
`data/image/sample.jpg` などがあれば、次の指定になります。
`![代替テキストを入力してください](/image/sample.jpg)`
![placeholdの画像](https://placehold.jp/150x150.png)
### 見出し3
スクリプトを記述することができます。
{script}
return (new Date()).toString()
{/script}
data/sample.md にサンプルを置いています。
コメントに変数を記述できます。
---
foo: fooVariableContent
bar: varVariableContent
---
and in template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
{{foo}}
{{bar}}
</body>
</html>
{{foo}}
と {{bar}}
は 'fooVariableContent'
と 'barVariableContent'
に置換されます。
---
someVariable: true
---
{if someVariable}
This content will be present.
{/if}
{if undefinedValue}
This content will be removed.
{else}
This is else content.
{/if}
{script}
// write javascript and return value
{/script}
AWS S3 にデプロイするには、 .github/workflow/deploy.yml.sample
を .github/workflow/deploy.yml
にコピーします。
また、 .env.prod
を作成して、以下の値を登録します。
SITE_NAME: テストサイト
URL_BASE: https://example.com
GTAG_ID: G-xxxx
GitHub のリポジトリで、settings > Secrets and variables > Actions
から、以下の変数を登録します。
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY_ID
S3_URL