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

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

Два подхода для Remix: статический файл без дополнительной настройки в public/ или ресурсный маршрут app/routes/llms[.]txt.ts, возвращающий Response в виде обычного текста, при необходимости сгенерированного из вашего контента.

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

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

- [ Вариант 1: статический файл в public/ ](#static)
- [ Вариант 2: маршрут ресурса ](#resource-route)
- [ Подход с плагином Vite ](#vite-plugin)
- [ Проверить ](#verify)              
Примечание

Какой подход выбрать?

Используйте  статический файл  если ваш  llms.txt  редко меняется, и генерировать
его из содержимого не нужно. Используйте  маршрут ресурса  
для динамической генерации, особенно если документация хранится в базе данных или создаётся из файлов
MDX.

## Вариант 1: статический файл в public/

Remix обслуживает всё в `public/` каталог статически в корне вашего сайта. Поместите файл
по адресу `public/llms.txt`, дополнительная настройка маршрутизации не требуется.
public/llms.txt, directory structure    Копировать     

```
# Remix static file approach
#
# Place your file at: public/llms.txt
# Remix (and the underlying Node/Cloudflare/Vercel adapter)
# serves everything in public/ at the root of your site.
#
# Project structure:
# your-remix-app/
# ├── public/
# │   └── llms.txt   ← add this
# ├── app/
# └── remix.config.js (or vite.config.ts)

```

Этот подход работает со всеми адаптерами Remix: **@remix-run/node**, **@remix-run/cloudflare**, **@remix-run/vercel**, и **@remix-run/netlify**. Статический файл имеет приоритет над любым совпадающим
маршрутом.

## Вариант 2: маршрут ресурса

Создайте маршрут ресурса в `app/routes/llms[.]txt.ts`. Этот `[.]` синтаксис экранирует точку в имени файла, чтобы Remix сопоставил её с URL-путём `/llms.txt`. Экспортируйте `loader` функцию, возвращающую `Response` с правильным `Content-Type`.
app/routes/llms[.]txt.ts    Копировать     

```
// app/routes/llms[.]txt.ts
// Remix resource route, the [.] escapes the dot in the filename
// This file is served at exactly /llms.txt
import type { LoaderFunctionArgs } from '@remix-run/node';

export async function loader({ request }: LoaderFunctionArgs) {
const content = `# Your Site

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

## Documentation

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

## Product

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

## Optional

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

return new Response(content, {
status: 200,
headers: {
'Content-Type': 'text/plain; charset=utf-8',
'Cache-Control': 'public, max-age=3600, stale-while-revalidate=86400',
},
});
}

```

Пример

Используйте Web Response, а не json()

Remix  json()  вспомогательная функция задаёт  Content-Type: application/json . Для  llms.txt  вы должны использовать  new Response(body, { headers: { 'Content-Type': 'text/plain; charset=utf-8' }
})  
напрямую.

Для динамической генерации из слоя контента получайте документы в загрузчике и программно
создавайте список ссылок Markdown:
app/routes/llms[.]txt.ts, dynamic    Копировать     

```
// app/routes/llms[.]txt.ts
// Generate from your content / MDX files
import type { LoaderFunctionArgs } from '@remix-run/node';
import { getAllDocs } from '~/models/docs.server';

export async function loader({ request }: LoaderFunctionArgs) {
// Fetch your documentation index from a DB or file system
const docs = await getAllDocs();

const links = docs
.map((doc) => `- [${doc.title}](https://yoursite.com/docs/${doc.slug}/): ${doc.summary}`)
.join('\n');

const body = [
'# Your Site',
'',
'> One-sentence summary of your project.',
'',
'## Documentation',
'',
links,
].join('\n');

return new Response(body, {
headers: {
'Content-Type': 'text/plain; charset=utf-8',
'Cache-Control': 'public, max-age=3600, stale-while-revalidate=86400',
},
});
}

```

## Подход с плагином Vite

Если вы используете Remix с Vite (по умолчанию для Remix v2.7+), можно сгенерировать `llms.txt` в рамках сборки с помощью плагина Vite. Созданный файл помещается в каталог
результатов сборки и обслуживается как статический ресурс. Это сочетает простоту статического файла
с доступом к содержимому во время сборки.
vite.config.ts, generate llms.txt at build    Копировать     

```
import { vitePlugin as remix } from '@remix-run/dev';
import { defineConfig } from 'vite';
import { writeFileSync } from 'node:fs';
import { resolve } from 'node:path';

// Simple Vite plugin to generate llms.txt at build time
function llmsTxtPlugin() {
return {
name: 'generate-llms-txt',
buildStart() {
const content = `# Your Site\n\n> Summary.\n\n## Documentation\n\n- [Docs](https://yoursite.com/docs): Guide.\n`;
writeFileSync(resolve(__dirname, 'public/llms.txt'), content, 'utf-8');
},
};
}

export default defineConfig({
plugins: [remix(), llmsTxtPlugin()],
});
```

## Проверить

После развёртывания убедитесь, что файл обслуживается корректно:
Verification    Копировать     

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

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

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

- [Как создать llms.txt](/ru/how-to-create/), шаблоны и контрольный список. 
- [Справочник формата llms.txt](/ru/llms-txt-format/), подробности спецификации. 
- [Руководство Vercel](/ru/llms-txt-vercel/), разверните Remix в Vercel. 
- [Руководство по Cloudflare Pages](/ru/llms-txt-cloudflare/), Remix в Cloudflare. 
- [Валидатор](/ru/validator/) · [Генератор](/ru/generator/).        
## Источники

- [ llmstxt.org, предложение сообщества ](https://llmstxt.org/)
- [ Документация Remix, маршруты ресурсов ](https://v2.remix.run/docs/guides/resource-routes/)
- [ Документация Remix, соглашения об именовании файлов ](https://v2.remix.run/docs/file-conventions/routes/)
