<!-- Generated from ja/llms-txt-eleventy/index.html. The canonical document is the HTML page. -->

- [ ホーム ](/ja/) 
/
- [ 作成方法 ](/ja/how-to-create/) 
/
- Eleventyガイド            
# Eleventy（11ty）向け`llms.txt`

Eleventyのテンプレートシステムなら、llms.txtを簡単に作成できます。permalinkのfrontmatterキーを持つプレーンテキストファイルを使用するか、コレクションをループしてコンテンツからリンクを自動生成します。

最終更新: 2026年4月22日

このページの内容

- [ 選択肢1: プレーンテキストテンプレート ](#static)
- [ オプション 2：コレクションから生成する ](#dynamic)
- [ パーマリンク設定 ](#permalink)
- [ 検証 ](#verify)            
## 選択肢1: プレーンテキストテンプレート

以下の場所にファイルを作成してください： `src/llms.txt` （または入力ディレクトリ内の任意の場所）。
`permalink` キーをYAMLフロントマターに指定して出力パスを制御します。Eleventyがファイルを処理し、
`_site/llms.txt`.
src/llms.txt    コピー     

```
---
permalink: /llms.txt
eleventyExcludeFromCollections: true
---
# Your Site

> One-sentence description of what your site or product does.

## Documentation

- [Getting Started](https://yoursite.com/docs/start): Install and configure in minutes.
- [API Reference](https://yoursite.com/docs/api): Full endpoint catalog with examples.

## Product

- [Overview](https://yoursite.com/product): Core features and capabilities.
- [Pricing](https://yoursite.com/pricing): Plans and billing details.

## Optional

- [Changelog](https://yoursite.com/changelog): Release history.
- [GitHub](https://github.com/your-org/your-repo): Source code.

```

例

templateFormats に txt を追加

Eleventy はデフォルトでは  .txt  ファイルをテンプレートとして使用。追加  'txt'  を次へ追加します：  templateFormats  配列に追加します（対象は  eleventy.config.js 。以下の設定スニペットを参照してください。
eleventy.config.js, enable txt templates    コピー     

```
// eleventy.config.js
module.exports = function (eleventyConfig) {
// Add passthrough copy for any assets you want served verbatim
// llms.txt is handled via permalink in the template, no passthrough needed

// Optional: add a collection for docs
eleventyConfig.addCollection('docs', function (collectionApi) {
return collectionApi.getFilteredByGlob('src/docs/**/*.md');
});

// Ensure .txt files are processed as templates
return {
templateFormats: ['md', 'njk', 'html', 'txt'],
dir: {
input: 'src',
output: '_site',
},
};
};

```

## オプション 2：コレクションから生成する

ドキュメントが frontmatter 付きの Markdown ファイルによる Eleventy
コレクションとして管理されている場合は、
テンプレート内でコレクションをループして、リンク一覧を自動生成できます。 `---js` JavaScript
ベースの設定には frontmatter 構文を、本文には Nunjucks/Liquid テンプレート構文を使用します。
src/llms.txt, from collections    コピー     

```
---js
{
permalink: "/llms.txt",
eleventyExcludeFromCollections: true
}
---
# Your Site

> {{ site.description }}

## Documentation

{% for doc in collections.docs | sort(attribute='data.order') -%}
- [{{ doc.data.title }}]({{ site.url }}{{ doc.url }}): {{ doc.data.description }}
{% endfor %}

```

`site.url` グローバルデータ変数は次で設定する必要があります： `_data/site.js` または `_data/site.json` ファイル。すべてのリンクで絶対URLを使用してください。
AIクローラーが取得した際、相対パスは正しく解決されません。

## パーマリンク設定

利用する llms.txt テンプレートの主要なフロントマターオプション: `llms.txt` テンプレート：

- `permalink: /llms.txt`、ファイルをサイトのルートディレクトリに出力してください。 
- `eleventyExcludeFromCollections: true`により、ファイルがサイトのコレクション（ナビゲーション、フィード、サイトマップ）に現れないようにします。 
- `layout: false`。これによりレイアウトのラッパーが適用されません（ `.txt` ファイルではデフォルトでHTMLレイアウトを使用しないためです）。   
## 検証

Eleventy のビルドを実行し、出力を確認します:
Build and verify    コピー     

```
# Build
npx @11ty/eleventy

# Check that the file was generated
cat _site/llms.txt | head -5

# After deploying, verify the live URL
curl -I https://yoursite.com/llms.txt
# Expected: content-type: text/plain; charset=utf-8
```

## 関連ガイド

- [llms.txtの作成方法](/ja/how-to-create/)、テンプレート、チェックリスト。 
- [llms.txt フォーマットリファレンス](/ja/llms-txt-format/)、仕様の詳細。 
- [Hugoガイド](/ja/llms-txt-hugo/)、同様の静的サイトジェネレータによるアプローチ。 
- [Gatsby ガイド](/ja/llms-txt-gatsby/)、Reactベースの静的生成。 
- [バリデータ](/ja/validator/) · [ジェネレーター](/ja/generator/).        
## ソース

- [ llmstxt.org、コミュニティによる提案 ](https://llmstxt.org/)
- [ Eleventyドキュメント、permalink ](https://www.11ty.dev/docs/permalinks/)
- [ Eleventy ドキュメント, collections ](https://www.11ty.dev/docs/collections/)
