Gratilaus Site 1.0.0

Choose your language.

言語を選んでください。

English

Gratilaus Site quick start

A guide to follow once, from top to bottom, the first time you use Gratilaus Site.
For the commands and how to fix common errors, see QUICK_REFERENCE.md.
Every setting is described in README.md.

0. What you need

  • Python 3.10 or later. To check, run python3 --version in a terminal (py --version on Windows).
  • A terminal: Terminal on macOS, Command Prompt on Windows.
  • Node.js, only for the site search. Steps 1 to 8 work without it.
  • Steps 1 to 8 run on your own computer and cost nothing. What publishing costs depends on where you publish (step 9).

Paste the commands one line at a time and press Enter.
Where macOS and Windows differ, both are shown.

1. Go into the folder

Unzip the download and go into its folder in the terminal.
Change 1.0.0 to the version number in the zip's name.

cd ~/Downloads/gratilaus-site-1.0.0

You can also type cd and then drag the folder from Finder onto the terminal window.

2. Prepare (the first time only)

This installs the two packages the project uses (Jinja2 and PyYAML) inside this folder only.

macOS and Linux:

python3 -m venv .venv
. .venv/bin/activate
pip install -r requirements.txt

Windows (Command Prompt):

py -m venv .venv
.venv\Scripts\activate
py -m pip install -r requirements.txt

In PowerShell, use .venv\Scripts\Activate.ps1 for the second line.

What success looks like: the prompt starts with (.venv), and the last output says Successfully installed.

When you open a new terminal later, run only the cd from step 1 and the second line (activate) again.

3. Build the sample site and look at it

python3 scripts/build.py --no-pagefind

On Windows: py scripts\build.py --no-pagefind.
--no-pagefind skips the search index, so Node.js is not needed.

What success looks like: the last line is ✓ done. The site is written to the output folder.

Then look at it in a browser.

python3 -m http.server -d output 8000

On Windows: py -m http.server -d output 8000.
When it says Serving HTTP on, open http://localhost:8000 in a browser.

To stop it, press Ctrl+C in the terminal.
After you change files in the steps below, stop it, run build.py, and start http.server again to see the change.
If you have looked at another site on the same number before, parts of that site may still show. Use another number then (for example 8001).

4. Choose the site's language

An English-only site: leave lang as it is. The files with .ja in their names are not used.

A Japanese-only site: in config/site.yaml, change lang: "en" to lang: "ja".

On a Japanese site, a file with .ja in its name, where there is one, comes first.

  • What config/site.ja.yaml sets wins over the same setting in config/site.yaml.
  • content/about/content.ja.html, where it exists, is used instead of content/about/content.html.
  • What meta.ja.yaml sets wins over the same setting in meta.yaml.

The rule: where a .ja file exists, edit that one.
Changes to the file without .ja do not show on a Japanese site.
A new page needs only the two files without .ja (step 6).

Both English and Japanese: one build makes one language. See "Languages" in README.md.

5. Change the site's name and address

Open config/site.yaml (on a Japanese site, config/site.ja.yaml) and change the following.

SettingWhat it is
nameThe site's name
short_nameA short name (used when the site is added to a phone's home screen)
taglineThe line under the name
descriptionThe site's description in search results
copyright_holderThe name in the footer's copyright line
name under authorThe author's name on articles
label in nav, footer_nav and sidebar_linksThe text of the menus

Write the address you will publish at in base_url in config/site.yaml, whatever the language.
For example base_url: "https://www.example.org", with no / at the end.

The home page's title and description are in content/index/meta.yaml (on a Japanese site, meta.ja.yaml). Change them too.

Look for the sample name and the sample address (example.com) anywhere they are left (macOS and Linux).

grep -rl -e "Example Site" -e "example.com" config/site.yaml config/site.ja.yaml content

What success looks like: nothing is printed. A file that is printed still has the sample name or address.
On a Japanese site, search for サンプルサイト instead of Example Site. On Windows, search for both words with your editor's "search in folder".

6. Add, change and remove pages

Each folder in content is one page. The folder's name becomes the address.
For example content/menu/ becomes /menu/.

To add a page, make a folder and put two files in it.

content/menu/meta.yaml:

page_type: page
title: "Menu"
description: "A short description of this page, for search results and shares."

content/menu/content.html holds the body only, in HTML. The title and the dates are added for you.

<p>Today's menu.</p>

A new page does not appear in the menus by itself.
Add a line to nav in config/site.yaml (on a Japanese site, config/site.ja.yaml).

  - { label: "Menu", url: "/menu/" }
  • To add a news article: copy the sample folder content/hello-world and change the copy. That is the quickest way.
  • To remove a sample page: delete its folder. The check in step 8 finds the links to it that are left on other pages.
  • Privacy policy and contact: content/privacy-policy and content/contact are samples. Rewrite them for your site. The contact form needs a place to send to (see "Contact form" in README.md).

7. Replace the images

Overwrite each image with one of the same name and the same size.

FileSizeWhere it is used
assets/img/logo.svgAnyThe logo at the top left
assets/img/ogp-default.png1200×630The picture when the page is shared on social media
static_root/favicon.icoAnyThe icon on the browser tab
The five PNG files in static_root/icons/As in the file nameThe icons on phones

The icons can wait. How to make them is in "PWA icons" in README.md.

8. Check the site

python3 scripts/check.py

On Windows: py scripts\check.py.

What success looks like: the last line is like ✓ all 24 checks passed. (the number depends on the settings).

A problem is listed by kind. In this example, the sample article was removed, but the home page still links to it.

  [broken internal link]
    - broken internal link -> /hello-world/
        1 page(s): index.html

Here, remove that link from the home page's body (content/index/content.html; on a Japanese site, content.ja.html).
Then run check.py again. How to fix common errors is in QUICK_REFERENCE.md.

9. Publish

Before publishing, make sure of these three.

  • base_url is your own address.
  • The sample names, pages and images are now yours (steps 5 to 7).
  • check.py passed (step 8).

About the search: a site built with --no-pagefind has no working search. Before publishing, do one of these.

  • Install Node.js and build with python3 scripts/build.py, without --no-pagefind.
  • Do without the search: in config/site.yaml, under features, change search: true to search: false.

Choose one of three places to publish.

  1. A server or static host you already use: put the contents of the output folder at the top of your domain as they are. The server must answer an address like /about/ with about/index.html (most servers do).

    • A manual deployment (the way without Git) on AWS Amplify Hosting is one of these. How to make the .zip and set up the 404 page is in "Amplify Hosting (manual deployment)" in README.md.
  2. GitHub Pages: put this folder in a GitHub repository, and set Settings → Pages → Source to "GitHub Actions". On every push to main, the included .github/workflows/pages.yml builds, checks and publishes the site.

    • It works for a site at https://<user name>.github.io/, or for a site with its own domain.
    • Finder hides the .github folder (Command+Shift+. shows it).
    • With this method, the language is the one in lang in config/site.yaml.
    • The other file there, ci.yml, runs this project's own tests on every push. Delete it if you do not want them.
  3. Amazon S3 and CloudFront: the included scripts/deploy.sh needs the AWS CLI, and only uploads the files and clears the cache. It mirrors output with --delete, so files in the bucket that are not in output are removed. Set these up yourself first.

    • An S3 bucket, a CloudFront distribution, a certificate (an ACM certificate for CloudFront is created in us-east-1), and DNS.
    • A way to answer /about/ with about/index.html. CloudFront's "default root object" does not apply to subdirectories, so use, for example, the S3 static website endpoint.

    When they are ready, copy the settings, fill them in, and first see only what would change.

    cp config/deploy.conf.example config/deploy.conf
    ./scripts/deploy.sh --build --dry-run

    In config/deploy.conf, set AWS_PROFILE, AWS_REGION, S3_BUCKET and CLOUDFRONT_DISTRIBUTION_ID.
    When it looks right, run it again without --dry-run. On Windows: .\scripts\deploy.cmd --build --dry-run.

About the license: the footer's Built with Gratilaus by H.K. is a condition of the license. As long as you leave it, visible and readable (not hidden by your own CSS, and at 4.5:1 contrast or more if you change the colors), there is nothing to do. The conditions for removing it are in "License" in README.md.

Back to the top

Gratilaus Site quick reference

A sheet to look things up in, from the second time on. The first time, start with QUICKSTART.md.
Every setting is described in README.md.

Commands

Run the commands in this folder, with (.venv) at the start of the prompt (step 2 of QUICKSTART.md).
On Windows, read python3 as py, / as \, and ./scripts/deploy.sh as .\scripts\deploy.cmd.

To do thisRun
Build the sitepython3 scripts/build.py
Build without Node.js (no search; for looking at it locally)python3 scripts/build.py --no-pagefind
Rebuild one page onlypython3 scripts/build.py --page about
Build in a given languagepython3 scripts/build.py --lang ja
Look at the built site (Ctrl+C stops it)python3 -m http.server -d output 8000
Check the sitepython3 scripts/check.py
Show every finding of the check, not only the first fewpython3 scripts/check.py --all
Show what was checked, passed items includedpython3 scripts/check.py --verbose
Before publishing, see only what would change (S3)./scripts/deploy.sh --build --dry-run
Publish (S3)./scripts/deploy.sh --build

Every command ends with exit code 0 when it succeeds. build.py and check.py end with 1 when the build stops or the check finds a problem, and with 2 when the command line is wrong (for check.py, also a --out directory that does not exist). deploy.sh and deploy.cmd end with 1 when they refuse to publish (the messages starting with !!), and otherwise with the exit code of the step that failed (build.py or the AWS CLI).

Which file to change

On a Japanese site, where a .ja file exists, edit that one (step 4 of QUICKSTART.md).

To changeFile
The site's name, description and authorsite in config/site.yaml (on a Japanese site, config/site.ja.yaml)
The address you publish atsite.base_url in config/site.yaml
The site's languagesite.lang in config/site.yaml
The menusnav, footer_nav and sidebar_links in config/site.yaml (on a Japanese site, config/site.ja.yaml)
The colorstheme.colors in config/site.yaml (light and dark pairs; their contrast is checked)
The fonts, the text column's width, spacing and corner roundingtheme.tokens in config/site.yaml ("Design tokens" in README.md)
The layout of the header, sidebar and search boxheader_layout, sidebar, sidebar_position, search_position and quickbar in theme in config/site.yaml
A look the settings cannot givePut your own CSS in assets/css/ and list it in theme.extra_css in config/site.yaml (do not edit main.css)
HTML in a fixed place (analytics, ads, a sources box…)Create a file in layout/hooks/ (the places are listed in layout/hooks/README.md)
CSS or JavaScript for one page onlypage_styles and page_scripts in that page's meta.yaml
The interface's fixed words ("Read more", say)strings in config/site.yaml (do not edit config/locales/)
Turning features on and off, such as the search and the share buttonsfeatures in config/site.yaml
The home page's title and bodycontent/index/
One pagecontent/<page>/meta.yaml and content.html
The logo and the social media pictureassets/img/logo.svg and assets/img/ogp-default.png
The iconsstatic_root/favicon.ico and static_root/icons/
Where the contact form sends tomailform.endpoint in config/site.yaml
The settings for publishing to S3config/deploy.conf (made by copying config/deploy.conf.example)

Your files and the product's files

To move to a new version, you replace the product's files with the new version's. If you edit a product file, you have to redo the edit at every new version, so change the look and the wording with the means in the table above.

KindFiles
Yours (a new version does not replace them)config/site.yaml, config/site.<lang>.yaml, config/env/, config/deploy.conf, content/, assets/img/, CSS you added to assets/css/, static_root/favicon.ico, static_root/icons/, files you added to static_root/, files you created in layout/hooks/, a config/locales/<lang>.yaml you added, scripts/content_filters.py, notes/
The product's (replaced when you move to a new version)In scripts/, build.py, check.py, deploy.py, deploy.sh and deploy.cmd; the .j2 files in layout/ (not those in hooks/); page_templates/; assets/css/main.css and compat-legacy.css; assets/js/site.js and mailform.js; config/site.schema.json; config/locales/en.yaml and ja.yaml; the .j2 files in static_root/; requirements.txt and pyproject.toml; LICENSE and NOTICE; AGENTS.md and the documents such as the README; .github/

The steps are in "Upgrading to a new version" in README.md.

Working with an AI coding agent

  • AGENTS.md in this folder gives AI coding agents (Codex, GitHub Copilot, Cursor, Claude Code and others) the rules for this project: which files to change, the license's credit, and what to leave to you.
  • Claude Code (v2.1.277 or later) reads AGENTS.md on its own only when there is no CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md in this folder or a folder above it. If you keep one, put the line @AGENTS.md at the top of your CLAUDE.md.
  • Gemini CLI reads GEMINI.md by default. Add "AGENTS.md" to context.fileName in its settings.json.

The smallest page

A page (content/<page>/meta.yaml):

page_type: page
title: "About this site"
description: "A short description of this page, for search results and shares."

A news article (content/<article>/meta.yaml):

page_type: article
title: "The site is open"
description: "A short description of this article, for search results and shares."
published: "2026-12-01T09:00:00+00:00"
section: "News"
category_id: news
section_url: "/category/news/"
tags: [News]

Write the body in HTML in content.html in the same folder. The title, the dates and the author are added for you.

Common errors and how to fix them

Look up an error by its first words.

MessageCauseFix
expected <block end>, but found '<block mapping start>'The indentation (the spaces at the start of the lines) in the YAML does not line upOn the line shown, or the line before it, make the spaces at the start match the lines around it
found character '\t' that cannot start any tokenThere is a tab in the YAMLReplace the tab with spaces
mapping values are not allowed hereA value has a : in itPut the value in "..."
expected <block end>, but found '<scalar>'A " is not closedClose the " on the line before the one shown
is not a date. Use YYYY-MM-DD ...The date is written another wayWrite it as "2026-12-01" or "2026-12-01T09:00:00+00:00"
a setting has a value it cannot takeA setting with a fixed set of values has another valueChoose one of the values after is not one of on the next line
navigation link(s) point at a page this build did not produceA menu url leads to no pageMatch the url on the next line to a folder in content
unknown page_typepage_type has a wrong value, and the page is not builtUse one of home, article, page, archive, error404
the search index was not builtNode.js is missingTo look at the site locally only, add --no-pagefind. To publish, install Node.js, or set search under features to false
broken internal link -> /…/A link to a page that does not exist (check.py)Fix that link in the body or the menu of the page shown on the next line
missing resource -> …A page loads an image or file that does not exist (check.py)Add the file, or fix the path
is written twice (first on line …)A key appears twice in one YAML mapping (two title:, two features: blocks)Keep one of the two lines shown
not saved as UTF-8The file was saved in another encoding (such as Shift_JIS)Save it as UTF-8 in your editor
mailform.endpoint must be an https:// URLThe contact form's endpoint is not an https:// URLWrite the URL Gratilaus Form printed (https://…/contact)
!! a page has a contact form with no endpointThe sample contact page is still there and mailform.endpoint is not set (the deploy script)Set mailform.endpoint, or delete content/contact and the menu items that point to it
!! no configuration fileThere is no config/deploy.confCopy config/deploy.conf.example to config/deploy.conf and fill it in
!! S3_BUCKET is still the example valueThe publishing settings are still the sampleWrite your bucket's name in config/deploy.conf
!! site.launch_date is still "pending"The launch date is not set yetSet launch_date in config/site.yaml to the day you go live (for example "2026-12-01"), and build again

Mistakes that give no error: check them yourself

The build and the check both pass with these mistakes.

  • base_url is missing or in the wrong form: the addresses given to search engines and shares are broken. Start it with https://, and do not end it with /.
  • On a Japanese site, you edited a file without .ja: the change does not show. Edit the .ja file.
  • A meta.yaml has no title: the page's title becomes the site's name.
  • tags is not a list: tags: News, Demo is split into single letters. Write tags: [News, Demo].
  • A misspelled category_id: a page for another category appears.
  • A folder with no meta.yaml: it does not become a page.

The license's credit

  • You may use, modify and redistribute it, including for commercial use, on the same terms as Apache-2.0 (the patent grant too). However, on top of the Apache-2.0 terms, every page of the site you build must visibly show Built with Gratilaus by H.K. (H.K. a link to https://hidekazu-konishi.com/) (Section 4A).
  • By default this credit is in the footer. As long as you keep credit.enabled: true in config/site.yaml and leave the credit visible, there is nothing to do.
  • Visible means: on every page (error pages and redirect-only pages aside), on every screen size and color scheme, without a click or hover. Do not hide it with your CSS or scripts, do not make it smaller than the smallest other text in the same area, and keep a contrast of at least 4.5:1 against its background (mind this when you change the colors). The link has to take a visitor to https://hidekazu-konishi.com/.
  • The conditions for removing it or changing its words (rewording or translating; it may not suggest that the author endorses the site) are in "License" in README.md.
  • When you give a site or its files (including the built output) to someone else, include the license (LICENSE) and tell them about the credit condition (Section 4A).

Terms

TermMeaning
TerminalThe window you type commands into: Terminal on macOS, Command Prompt on Windows
Virtual environment (venv, .venv)A way to install packages inside this folder only, apart from your other Python work
YAMLHow config/site.yaml and meta.yaml are written: name: value, one per line, with indentation for nesting
BuildMaking the files to publish, in output/, from content/ and config/
base_urlThe address the site is published at (like https://www.example.com), the base of the addresses given to search engines and shares
PagefindThe site search. Its index is made with Node.js at build time
Static hostA place that serves the built files as they are (GitHub Pages, Amazon S3 with CloudFront, Amplify Hosting, and others)
OGP imageThe picture shown when a page is shared on social media (assets/img/ogp-default.png)
CreditThe footer's Built with Gratilaus by H.K., a condition of the license

Back to the top

This page is made from QUICKSTART.md and QUICK_REFERENCE.md in this folder. Every feature and setting is described in README.md.

日本語

Gratilaus Site クイックスタート

初めての 1 回だけ、上から順に進めるための手順書です。
コマンドの一覧やエラーの直し方は QUICK_REFERENCE.ja.md にあります。
すべての設定の説明は README.ja.md にあります。

0. 必要なもの

  • Python 3.10 以降。ターミナルで python3 --version(Windows は py --version)を実行して確かめます。
  • ターミナル。macOS は「ターミナル」、Windows は「コマンドプロンプト」です。
  • Node.js は、サイト内検索を使うときだけ要ります。手順 1〜8 は Node.js 無しで進められます。
  • 手順 1〜8 は手元のパソコンだけで進むので、費用はかかりません。公開の費用は公開先によります(手順 9)。

コマンドは 1 行ずつ貼り付けて Enter を押します。
macOS と Windows でコマンドが違うところは、両方を書いています。

1. フォルダに入る

zip を展開し、ターミナルでそのフォルダに入ります。
1.0.0 は、zip の名前にある版の番号に合わせます。

cd ~/Downloads/gratilaus-site-1.0.0

cd と入力した後に、Finder からフォルダをターミナルの画面へドラッグしても、場所を入力できます。

2. 準備する(最初の 1 回だけ)

この製品が使う 2 つの部品(Jinja2 と PyYAML)を、このフォルダの中だけに入れます。

macOS・Linux:

python3 -m venv .venv
. .venv/bin/activate
pip install -r requirements.txt

Windows(コマンドプロンプト):

py -m venv .venv
.venv\Scripts\activate
py -m pip install -r requirements.txt

PowerShell では、2 行目を .venv\Scripts\Activate.ps1 にします。

成功の見え方: 行の先頭に (.venv) が付き、最後に Successfully installed が出ます。

ターミナルを開き直したときは、手順 1 の cd と、2 行目(activate)だけをもう一度実行します。

3. サンプルのサイトを作って見る

python3 scripts/build.py --no-pagefind

Windows では py scripts\build.py --no-pagefind です。
--no-pagefind は、検索の索引を作らない指定です。これで Node.js が要りません。

成功の見え方: 最後の行が ✓ done. です。作ったサイトは output フォルダに入ります。

次に、作ったサイトをブラウザで見ます。

python3 -m http.server -d output 8000

Windows では py -m http.server -d output 8000 です。
Serving HTTP on と出たら、ブラウザで http://localhost:8000 を開きます。

止めるときは、ターミナルで Ctrl+C を押します。
この後の手順でファイルを直したら、止める → build.py → http.server の順でやり直すと、変更が見えます。
別のサイトを同じ番号で見たことがあると、前のサイトの表示が残ることがあります。そのときは番号を変えます(例: 8001)。

4. サイトの言語を決める

日本語だけのサイト: config/site.yaml の lang: "en" を lang: "ja" に変えます。

日本語のサイトでは、名前に .ja が付いたファイルがあれば、そちらが優先されます。

  • config/site.ja.yaml に書いた項目は、config/site.yaml の同じ項目より優先されます。
  • content/about/content.ja.html があれば、content/about/content.html の代わりに使われます。
  • meta.ja.yaml に書いた項目は、meta.yaml の同じ項目より優先されます。

決まり: .ja の付いたファイルがあるものは、そちらを直します。
.ja の付かないほうを直しても、日本語のサイトには出ません。
新しく作るページは、.ja の付かない 2 つのファイルだけで足ります(手順 6)。

英語だけのサイト: lang はそのままにします。.ja の付いたファイルは使われません。

日本語と英語の両方: 1 回のビルドで作るのは 1 つの言語です。README.ja.md の「言語」を読んでください。

5. サイトの名前と URL を変える

日本語のサイトでは config/site.ja.yaml、英語のサイトでは config/site.yaml を開いて、次を書き換えます。

項目中身
nameサイトの名前
short_name短い名前(スマートフォンのホーム画面に置いたときの名前)
tagline名前の下に出るひと言
description検索結果に出るサイトの説明
copyright_holderフッターの著作権の名前
author の name記事の著者の名前
nav・footer_nav・sidebar_links の labelメニューの文字

公開するアドレスは、言語にかかわらず config/site.yaml の base_url に書きます。
例: base_url: "https://www.example.org"。最後に / を付けません。

トップページの題名と説明は、content/index/meta.ja.yaml(英語のサイトは meta.yaml)にあります。ここも書き換えます。

見本の名前と見本のアドレス(example.com)が残っていないかを探します(macOS・Linux)。

grep -rl -e "サンプルサイト" -e "example.com" config/site.yaml config/site.ja.yaml content

成功の見え方: 何も表示されません。表示されたファイルに、見本の名前かアドレスが残っています。
Windows では、エディタの「フォルダー内を検索」で サンプルサイト と example.com を探します。

6. ページを足す・直す・消す

content の中の 1 つのフォルダが、1 つのページです。フォルダの名前がアドレスになります。
例: content/menu/ は /menu/ になります。

ページを足すときは、フォルダを作り、2 つのファイルを置きます。

content/menu/meta.yaml:

page_type: page
title: "メニュー"
description: "検索結果やシェアに出る、このページの短い説明。"

content/menu/content.html には、本文だけを HTML で書きます。題名や日付は自動で付きます。

<p>本日のメニューです。</p>

足したページは、自動ではメニューに出ません。
config/site.ja.yaml(英語のサイトは config/site.yaml)の nav に、1 行を足します。

  - { label: "メニュー", url: "/menu/" }
  • お知らせ(記事)を足す: 見本の content/hello-world をフォルダごと写し、写したほうを書き換えるのが早い方法です。
  • 見本のページを消す: フォルダを削除します。ほかのページからのリンクが残っていると、手順 8 の検査で分かります。
  • プライバシーポリシーとお問い合わせ: content/privacy-policy と content/contact は見本です。自分のサイトに合わせて書き換えます。問い合わせのフォームを動かすには送信先が要ります(README.ja.md の「お問い合わせフォーム」)。

7. 画像を差し替える

同じ名前・同じ大きさの画像で上書きします。

ファイル大きさ使われる場所
assets/img/logo.svg自由ページの左上のロゴ
assets/img/ogp-default.png1200×630SNS でシェアしたときの画像
static_root/favicon.ico自由ブラウザのタブのアイコン
static_root/icons/ の 5 つの PNGファイル名のとおりスマートフォンのアイコン

アイコンは後回しにしてもかまいません。作り方は README.ja.md の「PWA のアイコン」にあります。

8. 検査する

python3 scripts/check.py

Windows では py scripts\check.py です。

成功の見え方: 最後の行が ✓ all 24 checks passed. のような行です(数は設定で変わります)。

問題があると、種類ごとの一覧が出ます。次は、見本の記事を消したのに、トップページにそのリンクが残っている例です。

  [broken internal link]
    - broken internal link -> /hello-world/
        1 page(s): index.html

この例では、トップページの本文(日本語のサイトは content/index/content.ja.html)から、そのリンクを消します。
直したら、もう一度 check.py を実行します。よくあるエラーの直し方は QUICK_REFERENCE.ja.md にあります。

9. 公開する

公開の前に、次の 3 つを確かめます。

  • base_url を自分のアドレスにした。
  • 見本の名前・ページ・画像を自分のものにした(手順 5〜7)。
  • check.py が成功した(手順 8)。

検索について: --no-pagefind で作ったサイトでは、検索が動きません。公開するときは、次のどちらかにします。

  • Node.js を入れて、--no-pagefind を付けずに python3 scripts/build.py で作る。
  • 検索を使わない。config/site.yaml の features の search: true を search: false にする。

公開先は 3 つから選びます。

  1. 契約しているサーバーや静的ホスティング: output フォルダの中身を、そのままドメインの直下に置きます。/about/ のようなアドレスで about/index.html を返すサーバーが必要です(多くのサーバーはそうなっています)。

    • AWS Amplify Hosting の手動デプロイ(Git を使わない方法)も、ここに入ります。.zip の作り方と 404 の設定は、README.ja.md の「Amplify Hosting(手動デプロイ)」にあります。
  2. GitHub Pages: このフォルダを GitHub のリポジトリに入れ、Settings → Pages → Source を「GitHub Actions」にします。main へ push するたびに、同梱の .github/workflows/pages.yml が、ビルド・検査・公開をします。

    • 使えるのは、https://<ユーザー名>.github.io/ のサイトか、独自ドメインを付けたサイトです。
    • .github フォルダは、Finder では隠れています(Command+Shift+. で表示)。
    • この方法では、言語は config/site.yaml の lang で決まります。
    • 同じ場所の ci.yml は、この製品自身の試験を push のたびに回します。要らなければ消します。
  3. Amazon S3 と CloudFront: 同梱の scripts/deploy.sh は AWS CLI を使い、ファイルを送ってキャッシュを消すだけです。output と同じ中身にするので(--delete)、output に無いバケットのファイルは消えます。次のものは先に自分で用意します。

    • S3 バケット、CloudFront のディストリビューション、証明書(CloudFront で使う ACM の証明書は us-east-1 で作る)、DNS。
    • /about/ で about/index.html を返す仕組み。CloudFront の「デフォルトルートオブジェクト」はサブディレクトリには効かないため、S3 の静的ウェブサイトのエンドポイントを使う方法などがあります。

    用意ができたら、設定を写して書き換え、まず変更点だけを確かめます。

    cp config/deploy.conf.example config/deploy.conf
    ./scripts/deploy.sh --build --dry-run

    config/deploy.conf には、AWS_PROFILE・AWS_REGION・S3_BUCKET・CLOUDFRONT_DISTRIBUTION_ID を書きます。
    確かめたら、--dry-run を外して実行します。Windows では .\scripts\deploy.cmd --build --dry-run です。

ライセンスについて: フッターの Built with Gratilaus by H.K. は、ライセンスの条件です。見える形のまま(自分の CSS で隠さず、色を変えるならコントラスト 4.5:1 以上で)残せば、何もしなくてかまいません。消したいときの条件は、README.ja.md の「ライセンス」にあります。

ページの先頭へ

Gratilaus Site クイックリファレンス

2 回目からの早見表です。初めての方は QUICKSTART.ja.md から始めてください。
すべての設定の説明は README.ja.md にあります。

コマンド

コマンドは、このフォルダの中で、(.venv) が付いた状態で実行します(QUICKSTART.ja.md の手順 2)。
Windows では python3 を py に、/ を \ に、./scripts/deploy.sh を .\scripts\deploy.cmd に読み替えます。

したいことコマンド
サイトを作るpython3 scripts/build.py
Node.js 無しで作る(検索なし・手元で見る用)python3 scripts/build.py --no-pagefind
1 ページだけ作り直すpython3 scripts/build.py --page about
言語を指定して作るpython3 scripts/build.py --lang ja
作ったサイトを見る(Ctrl+C で止める)python3 -m http.server -d output 8000
検査するpython3 scripts/check.py
検査の指摘を打ち切らずに全部出すpython3 scripts/check.py --all
合格した項目も含めて、何を確かめたかを出すpython3 scripts/check.py --verbose
公開の前に、変わる点だけを見る(S3)./scripts/deploy.sh --build --dry-run
公開する(S3)./scripts/deploy.sh --build

どのコマンドも、うまくいけば終了コード 0 で終わります。build.py と check.py は、ビルドが止まったときと検査で問題が見つかったときに 1、コマンドの書き方の誤り(check.py では、--out に無いディレクトリを渡したときも)に 2 で終わります。deploy.sh と deploy.cmd は、公開を断ったとき(!! で始まるメッセージ)に 1、それ以外の失敗では、失敗した段(build.py か AWS CLI)の終了コードで終わります。

どのファイルで何を変えるか

日本語のサイトでは、.ja の付いたファイルがあればそちらを直します(QUICKSTART.ja.md の手順 4)。

変えたいものファイル
サイトの名前・説明・著者config/site.ja.yaml(英語のサイトは config/site.yaml)の site
公開するアドレスconfig/site.yaml の site.base_url
サイトの言語config/site.yaml の site.lang
メニューconfig/site.ja.yaml(英語のサイトは config/site.yaml)の nav・footer_nav・sidebar_links
色config/site.yaml の theme.colors(ライトとダークの組。コントラストは検査される)
字体・本文の幅・余白・角の丸みconfig/site.yaml の theme.tokens(README.ja.md の「デザイントークン」)
ヘッダー・サイドバー・検索欄の並びconfig/site.yaml の theme の header_layout・sidebar・sidebar_position・search_position・quickbar
設定では足りない見た目自分の CSS を assets/css/ に置き、config/site.yaml の theme.extra_css に書く(main.css は直さない)
決まった位置に HTML を足す(アクセス解析・広告・出典の欄など)layout/hooks/ にファイルを作る(置ける場所の一覧は layout/hooks/README.md)
1 ページだけの CSS・JSそのページの meta.yaml の page_styles・page_scripts
画面の決まった文言(「続きを読む」など)config/site.yaml の strings(config/locales/ は直さない)
検索・共有ボタンなどの機能の入り切りconfig/site.yaml の features
トップページの題名と本文content/index/
1 つのページcontent/<ページ>/meta.yaml と content.html
ロゴ・SNS の画像assets/img/logo.svg・assets/img/ogp-default.png
アイコンstatic_root/favicon.ico・static_root/icons/
問い合わせフォームの送信先config/site.yaml の mailform.endpoint
S3 への公開の設定config/deploy.conf(config/deploy.conf.example を写して作る)

自分のファイルと製品のファイル

新しい版に上げるときは、製品のファイルを新しい版のもので置き換えます。製品のファイルを直すと、版を上げるたびに手で直し直すことになります。見た目や文言は、上の表の手段で変えます。

区分ファイル
自分のもの(版を上げても置き換えない)config/site.yaml・config/site.<言語>.yaml・config/env/・config/deploy.conf・content/・assets/img/・assets/css/ に足した CSS・static_root/favicon.ico・static_root/icons/・static_root/ に足したファイル・layout/hooks/ に作ったファイル・自分で足した config/locales/<言語>.yaml・scripts/content_filters.py・notes/
製品のもの(版を上げるときに置き換える)scripts/ の build.py・check.py・deploy.py・deploy.sh・deploy.cmd、layout/ の .j2(hooks/ の中を除く)、page_templates/、assets/css/main.css・compat-legacy.css、assets/js/site.js・mailform.js、config/site.schema.json、config/locales/en.yaml・ja.yaml、static_root/ の .j2、requirements.txt・pyproject.toml、LICENSE・NOTICE、AGENTS.md と README などの文書、.github/

上げ方の手順は、README.ja.md の「新しい版に上げる」にあります。

AI のコーディングエージェントを使うとき

  • このフォルダーの AGENTS.md は、AI のコーディングエージェント(Codex・GitHub Copilot・Cursor・Claude Code など)に、このプロジェクトの決まりを伝えます。どのファイルを変えるか、ライセンスのクレジット、人に任せることです(英語)。
  • Claude Code(v2.1.277 以降)が AGENTS.md を自分で読むのは、このフォルダーとその上のフォルダーに CLAUDE.md・.claude/CLAUDE.md・CLAUDE.local.md のどれも無いときだけです。CLAUDE.md を使っているなら、その先頭に @AGENTS.md の 1 行を書きます。
  • Gemini CLI は、既定では GEMINI.md を読みます。settings.json の context.fileName に "AGENTS.md" を足します。

ページの最小の例

固定のページ(content/<ページ>/meta.yaml):

page_type: page
title: "このサイトについて"
description: "検索結果やシェアに出る、このページの短い説明。"

お知らせの記事(content/<記事>/meta.yaml):

page_type: article
title: "サイトを開きました"
description: "検索結果やシェアに出る、この記事の短い説明。"
published: "2026-12-01T09:00:00+09:00"
section: "お知らせ"
category_id: news
section_url: "/category/news/"
tags: [お知らせ]

本文は、同じフォルダの content.html に HTML で書きます。題名・日付・著者は自動で付きます。

よくあるエラーと直し方

エラーは英語で出ます。最初の部分で探してください。

出るメッセージ原因直し方
expected <block end>, but found '<block mapping start>'YAML の字下げ(行頭の空白の数)がそろっていない出た行か、その 1 つ前の行の、行頭の空白の数を上下の行とそろえる
found character '\t' that cannot start any tokenYAML にタブ文字が入っているタブを空白に置き換える
mapping values are not allowed here値の中に : がある値を "..." で囲む
expected <block end>, but found '<scalar>'" の閉じ忘れ出た行の 1 つ前の行の " を閉じる
is not a date. Use YYYY-MM-DD ...日付の書き方が違う"2026-12-01" か "2026-12-01T09:00:00+09:00" の形で書く
a setting has a value it cannot take決まった値から選ぶ設定に、ほかの値を書いた次の行の is not one of の後に並ぶ値から選ぶ
navigation link(s) point at a page this build did not produceメニューの url の先にページが無い次の行に出る url を、content にあるフォルダの名前に合わせる
unknown page_typepage_type の値が違う。そのページは作られないhome・article・page・archive・error404 のどれかにする
the search index was not builtNode.js が無い手元で見るだけなら --no-pagefind を付ける。公開するなら Node.js を入れるか、features の search を false にする
broken internal link -> /…/無いページへのリンク(check.py)次の行に出るページの本文かメニューから、そのリンクを直す
missing resource -> …無い画像やファイルを読んでいる(check.py)ファイルを置くか、パスを直す
is written twice (first on line …)YAML の 1 つの対応表に同じキーが 2 回ある(title: が 2 つ、features: が 2 つなど)示された 2 つの行の片方を消す
not saved as UTF-8ファイルが UTF-8 以外(Shift_JIS など)で保存されているエディタで UTF-8 にして保存し直す
mailform.endpoint must be an https:// URL問い合わせのフォームの送信先が https:// の URL でないGratilaus Form が表示した URL(https://…/contact)を書く
!! a page has a contact form with no endpoint見本の問い合わせのページが残っていて、mailform.endpoint が未設定(デプロイのスクリプト)mailform.endpoint を書くか、content/contact とそこへのメニューの項目を消す
!! no configuration fileconfig/deploy.conf が無いconfig/deploy.conf.example を config/deploy.conf に写して書き換える
!! S3_BUCKET is still the example value公開の設定が見本のままconfig/deploy.conf に自分のバケットの名前を書く
!! site.launch_date is still "pending"公開の日が未定のままconfig/site.yaml の launch_date を公開する日(例: "2026-12-01")にして、作り直す

エラーにならないので、自分で確かめること

次の誤りは、ビルドも検査も成功のまま通ります。

  • base_url が無い・形が違う: 検索エンジンやシェアに渡るアドレスが壊れます。https:// から書き、最後に / を付けません。
  • 日本語のサイトで .ja の付かないファイルを直した: 変更が出ません。.ja の付いたほうを直します。
  • meta.yaml に title が無い: ページの題名がサイトの名前になります。
  • tags をリストにしていない: tags: お知らせ, デモ は 1 文字ずつに分かれます。tags: [お知らせ, デモ] と書きます。
  • category_id の書き間違い: 別のカテゴリーのページが新しくできます。
  • meta.yaml の無いフォルダ: ページになりません。

ライセンスのクレジット

  • 使う・改変する・再配布する・商用で使うことは、Apache-2.0 と同じ条件でできます(特許の許諾も同じです)。ただし、Apache-2.0 の条件に加えて、作ったサイトの全ページに、Built with Gratilaus by H.K.(H.K. は https://hidekazu-konishi.com/ へのリンク)を見える形で表示することが必要です(第 4A 節)。
  • 既定では、このクレジットがフッターに出ます。config/site.yaml の credit.enabled: true のまま、見える形のまま残せば、何もしなくてかまいません。
  • 見える形とは: 全ページ(エラーのページと転送だけのページを除く)に、どの画面幅・配色でも、クリックやホバーなしで見えることです。自分の CSS やスクリプトで隠さず、同じ場所のいちばん小さい文字より小さくせず、背景とのコントラストを 4.5:1 以上にします(色を変えるときに気をつけます)。リンクは、押せば https://hidekazu-konishi.com/ に着くものにします。
  • 消したいとき・文を変えたいとき(言い換え・翻訳。作者が推薦しているとほのめかす文にはできません)の条件は、README.ja.md の「ライセンス」にあります。
  • サイトやそのファイル(作った output を含む)を他人に渡すときは、ライセンス(LICENSE)を付け、クレジットの条件(第 4A 節)を相手に伝えます。

用語

用語意味
ターミナルコマンドを打ち込む画面。macOS は「ターミナル」、Windows は「コマンドプロンプト」
仮想環境(venv・.venv)このフォルダーの中だけに部品を入れる仕組み。ほかの Python の作業とまざらない
YAMLconfig/site.yaml や meta.yaml の書き方。「名前: 値」を行ごとに書き、字下げで入れ子を表す
ビルドcontent/ と config/ から、公開するファイル一式を output/ に作ること
base_urlサイトを公開するアドレス(https://www.example.com の形)。検索エンジンやシェアに渡すアドレスの元
Pagefindサイト内検索の部品。ビルドのときに Node.js で索引を作る
静的ホスティング作ったファイルをそのまま配る公開先(GitHub Pages、Amazon S3 と CloudFront、Amplify Hosting など)
OGP の画像SNS でページをシェアしたときに出る画像(assets/img/ogp-default.png)
クレジットフッターの Built with Gratilaus by H.K.。ライセンスの条件

ページの先頭へ

このページは、このフォルダーの QUICKSTART.ja.md と QUICK_REFERENCE.ja.md から作っています。すべての機能と設定の説明は README.ja.md にあります。