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

- [ الرئيسية ](/ar/) 
/
- [ كيفية إنشاء ](/ar/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)

```

يعمل هذا النهج مع جميع adapters في 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](/ar/how-to-create/), والقوالب وقائمة الفحص. 
- [مرجع تنسيق llms.txt](/ar/llms-txt-format/), تفاصيل المواصفة. 
- [دليل Vercel](/ar/llms-txt-vercel/), انشر Remix على Vercel. 
- [دليل Cloudflare Pages](/ar/llms-txt-cloudflare/)، Remix على Cloudflare. 
- [المدقّق](/ar/validator/) · [المولّد](/ar/generator/).        
## المصادر

- [ llmstxt.org، اقتراح المجتمع ](https://llmstxt.org/)
- [ توثيق Remix، ومسارات الموارد ](https://v2.remix.run/docs/guides/resource-routes/)
- [ توثيق Remix، اصطلاحات الملفات ](https://v2.remix.run/docs/file-conventions/routes/)
