<!-- Generated from ru/llms-txt-github-pages/index.html. The canonical document is the HTML page. -->

- [ Главная ](/ru/) 
/
- [ Как создать ](/ru/how-to-create/) 
/
- Руководство по GitHub Pages            
# `llms.txt` для GitHub Pages

Три подхода для GitHub Pages: статический файл, зафиксированный в docs/ или gh-pages, шаблон Jekyll для автоматической генерации content или рабочий процесс GitHub Actions для полностью автоматической генерации.

Последнее обновление: 22 апреля 2026 г.

На этой странице

- [ Вариант 1: статический файл в docs/ или gh-pages ](#static)
- [ Вариант 2: Jekyll с layout: null ](#jekyll)
- [ Вариант 3: GitHub Actions для динамической генерации ](#actions)
- [ Пользовательский домен и CNAME ](#custom-domain)
- [ Проверить ](#verify)            
## Вариант 1: статический файл в docs/ или gh-pages

Самый простой подход — зафиксировать в коммите `llms.txt` как обычный файл в репозиторий.
GitHub Pages отдаёт его как есть с правильным MIME-типом.
GitHub Pages directory structure    Копировать     

```
# GitHub Pages, static file approach
#
# Serving from docs/ branch (most common):
#   your-repo/
#   ├── docs/
#   │   ├── index.html
#   │   └── llms.txt   ← add this file here
#   └── README.md
#
# Serving from gh-pages branch:
#   Create or switch to the gh-pages branch, then add:
#   llms.txt   ← in the branch root
#
# In repository Settings → Pages:
#   Source: Deploy from a branch
#   Branch: main (or gh-pages), Folder: /docs (or /)
#
# GitHub Pages serves it at: https://username.github.io/repo/llms.txt
# With a custom domain: https://yourdomain.com/llms.txt

```

GitHub Pages автоматически распознаёт обычные текстовые файлы и отдаёт их с `Content-Type: text/plain; charset=utf-8`. Настройка не требуется.

Пример

Расположение файла зависит от конфигурации Pages

Если исходный код вашего сайта настроен на  корень / , разместите  llms.txt  в корне репозитория. Если задано значение  docs/ ,
разместите его внутри  docs/ . Проверьте раздел Settings → Pages.

## Вариант 2: Jekyll с layout: null

Если ваш сайт GitHub Pages использует Jekyll (по умолчанию для многих репозиториев), обычный `.txt` файл будет передан без изменений, front matter не требуется. Однако если вы хотите,
чтобы Jekyll обрабатывал файл как шаблон (например, подставлял переменные сайта), добавьте блок front
matter с `layout: null` чтобы Jekyll не оборачивал его в HTML-макет.
llms.txt, with Jekyll front matter    Копировать     

```
---
layout: null
permalink: /llms.txt
---
# My Project

> One-sentence description of what my project does.

## Documentation

- [Getting Started](https://myproject.com/docs/start/): Install and configure.
- [API Reference](https://myproject.com/docs/api/): Full endpoint catalog.

## Optional

- [Changelog](https://myproject.com/changelog/): Release history.

```

Список ссылок также можно получать из файла данных YAML в `_data/`, отделив содержимое от шаблона:
_data/llms_links.yml    Копировать     

```
# _data/llms_links.yml
docs:
- title: "Getting Started"
url: "https://myproject.com/docs/start/"
desc: "Install and configure in minutes."
- title: "API Reference"
url: "https://myproject.com/docs/api/"
desc: "Full endpoint catalog with examples."
optional:
- title: "Changelog"
url: "https://myproject.com/changelog/"
desc: "Release history."

```
llms.txt, Jekyll template with _data    Копировать     

```
---
layout: null
permalink: /llms.txt
---
# {{ site.title }}

> {{ site.description }}

## Documentation
{% for link in site.data.llms_links.docs %}
- [{{ link.title }}]({{ link.url }}): {{ link.desc }}
{% endfor %}

## Optional
{% for link in site.data.llms_links.optional %}
- [{{ link.title }}]({{ link.url }}): {{ link.desc }}
{% endfor %}

```

## Вариант 3: GitHub Actions для динамической генерации

Для сайтов, где список ссылок должен автоматически создаваться из содержимого (файлов Markdown,
frontmatter, CMS), используйте рабочий процесс GitHub Actions, который запускает скрипт и
фиксирует результат обратно в репозитории.
.github/workflows/generate-llms-txt.yml    Копировать     

```
# .github/workflows/generate-llms-txt.yml
# Generates llms.txt from your content and commits it to the repo.
name: Generate llms.txt

on:
push:
branches: [main]
paths:
- 'docs/**'
- 'content/**'
workflow_dispatch:

jobs:
generate:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Generate llms.txt
run: node scripts/generate-llms-txt.js

- name: Commit and push if changed
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add docs/llms.txt
git diff --staged --quiet || git commit -m "chore: regenerate llms.txt"
git push

```
scripts/generate-llms-txt.js    Копировать     

```
// scripts/generate-llms-txt.js
// Run by GitHub Actions to generate docs/llms.txt from your content
const fs = require('fs');
const path = require('path');

const SITE_URL = 'https://myproject.com';

// Example: build link list from your markdown files in docs/
const docsDir = path.join(__dirname, '..', 'docs');
const mdFiles = fs.readdirSync(docsDir)
.filter(f => f.endsWith('.md') && f !== 'index.md');

const links = mdFiles.map(file => {
const content = fs.readFileSync(path.join(docsDir, file), 'utf-8');
const titleMatch = content.match(/^#\s+(.+)/m);
const descMatch = content.match(/^>\s+(.+)/m);
const slug = file.replace('.md', '');
const title = titleMatch ? titleMatch[1] : slug;
const desc = descMatch ? descMatch[1] : '';
return `- [${title}](${SITE_URL}/docs/${slug}/): ${desc}`;
}).join('\n');

const output = [
'# My Project',
'',
'> My project description.',
'',
'## Documentation',
'',
links,
'',
'## Optional',
'',
`- [Changelog](${SITE_URL}/changelog/): Release history.`,
].join('\n');

fs.writeFileSync(path.join(docsDir, 'llms.txt'), output, 'utf-8');
console.log('Generated docs/llms.txt');

```

Рабочий процесс запускается при отправке изменений в `main` которые изменяют каталоги с
контентом и могут также запускаться вручную через `workflow_dispatch`. Коммит
создаётся только если сгенерированный файл действительно изменился.

## Пользовательский домен и CNAME

Если вы используете собственный домен (например, `myproject.com`), добавьте a `CNAME` файл в каталоге документации, содержащий ваш домен. GitHub Pages будет обслуживать
ваш сайт, включая `llms.txt`, на этом домене.
docs/CNAME    Копировать     

```
myproject.com
```

Используйте абсолютные URL в своём `llms.txt` соответствующие вашему пользовательскому
домену, а не домену по умолчанию `username.github.io/repo` URL.

## Проверить
Verification    Копировать     

```
curl -I https://myproject.com/llms.txt
# Expected:
# HTTP/2 200
# content-type: text/plain; charset=utf-8

curl https://myproject.com/llms.txt | head -5
```

## Связанные руководства

- [Как создать llms.txt](/ru/how-to-create/), шаблоны и контрольный список. 
- [Справочник формата llms.txt](/ru/llms-txt-format/), подробности спецификации. 
- [Руководство по Eleventy](/ru/llms-txt-eleventy/), ещё один генератор статических
сайтов. 
- [Руководство по Hugo](/ru/llms-txt-hugo/), статический сайт с шаблонами Go. 
- [Валидатор](/ru/validator/) · [Генератор](/ru/generator/).        
## Источники

- [ llmstxt.org, предложение сообщества ](https://llmstxt.org/)
- [ Документация GitHub Pages ](https://docs.github.com/en/pages)
- [ Документация Jekyll, front matter ](https://jekyllrb.com/docs/front-matter/)
