Giter Site home page Giter Site logo

blog_template's Introduction

blog template

プレビュー

以下のコマンドでプレビューできます。

npm run watch

http://localhost:8000/

デフォルトでは8000ポートを利用しますが、環境変数を使ってポート番号を上書きできます。

PORT=8001 npm run watch

記事を書く

./data/ 以下にマークダウンファイルを入稿します。

ファイル冒頭を --- でくくると変数を指定できます。
titleurlpublishedが必須です。
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' に置換されます。

IF

---
someVariable: true
---
{if someVariable}
This content will be present.
{/if}

{if undefinedValue}
This content will be removed.
{else}
This is else content.
{/if}

SCRIPT

{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

blog_template's People

Contributors

amashigeseiji avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.