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

- [ الرئيسية ](/ar/) 
/
- [ كيفية إنشاء ](/ar/how-to-create/) 
/
- دليل Nuxt.js            
# `llms.txt` لـ Nuxt.js

ثلاثة نهوج لـ Nuxt.js: ملف ثابت في public/ (بلا إعداد)، أو مسار خادم Nitro للتوليد الديناميكي، أو توليد تلقائي من وثائق Nuxt Content.

آخر تحديث: 22 أبريل 2026

في هذه الصفحة

- [ الخيار 1: ملف ثابت في public/ ](#static)
- [ الخيار 2: مسار API على الخادم ](#server-route)
- [ الخيار 3: الإنشاء التلقائي عبر Nuxt Content ](#nuxt-content)
- [ Nitro وأهداف النشر ](#nitro)
- [ تحقّق ](#verify)              
ملاحظة

أي نهج أستخدم؟

استخدم  ملف ثابت  إذا كان  llms.txt  نادراً ما يتغير. استخدم  مسار خادم  إذا كنت تريد إنشاؤه من محتواك وقت الطلب أو وقت البناء. استخدم  تكامل Nuxt Content  إذا كنت تدير التوثيق في ملفات Markdown.

## الخيار 1: ملف ثابت في public/

ينسخ Nuxt كل شيء إلى `public/` الدليل مباشرةً إلى مخرجات البناء، حيث يُقدَّم في جذر موقعك.
ضع ملفك في `public/llms.txt` وسيكون متاحاً في `/llms.txt` عند كل هدف نشر.
public/llms.txt, directory structure    نسخ     

```
# Nuxt static file approach
#
# Place your file at: public/llms.txt
# Nuxt copies everything in public/ directly to the build output.
#
# Project structure:
# your-nuxt-app/
# ├── public/
# │   └── llms.txt   ← add this
# ├── pages/
# └── nuxt.config.ts
#
# No configuration needed. Works with all deployment presets.

```

لا يتطلب هذا النهج أي إعداد ويعمل بالطريقة نفسها عبر جميع إعدادات Nitro المسبقة: **node-server**, **cloudflare-pages**, **vercel**, **netlify**، و **ثابت**.

## الخيار 2: مسار API على الخادم

أنشئ ملفاً في `server/routes/llms.txt.ts`. ويعيّن محرك Nitro في Nuxt الملفات في `server/routes/` مباشرةً إلى مسارات URL، ولذلك يُقدَّم هذا الملف بالضبط في `/llms.txt` من دون إعداد توجيه
إضافي.
server/routes/llms.txt.ts    نسخ     

```
// server/routes/llms.txt.ts
// Nuxt server route, served at /llms.txt
export default defineEventHandler(() => {
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 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.
`;

setResponseHeader(event, 'Content-Type', 'text/plain; charset=utf-8');
setResponseHeader(event, 'Cache-Control', 'public, max-age=3600, stale-while-revalidate=86400');
return content;
});

```

استخدم `setResponseHeader` من `h3` مكتبة (مضمّنة مع Nuxt) لضبط `Content-Type`. أضف `Cache-Control` الرأس حتى تخزّن حواف CDN الاستجابة مؤقتاً وتخفف الحمل عن المصدر.

## الخيار 3: التوليد التلقائي عبر Nuxt Content

إذا كنت تستخدم [Nuxt Content](https://content.nuxt.com/) للتوثيق، يمكنك الاستعلام عن مجموعة
المحتوى لديك وإنشاء قائمة الروابط تلقائياً. وهذا يضمن `llms.txt` يبقى متزامناً مع توثيقك
من دون تحديثات يدوية.
server/routes/llms.txt.ts, Nuxt Content    نسخ     

```
// server/routes/llms.txt.ts
// Auto-generate llms.txt from Nuxt Content documents
import { serverQueryContent } from '#content/server';

export default defineEventHandler(async (event) => {
// Query all docs; adjust collection name as needed
const docs = await serverQueryContent(event, '/docs')
.only(['title', 'description', '_path'])
.find();

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

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

setResponseHeader(event, 'Content-Type', 'text/plain; charset=utf-8');
return body;
});

```

اضبط مسار الاستعلام (`/docs`) وأسماء الحقول لتطابق بنية محتواك. شغّل [المدقّق](/ar/validator/) بعد النشر لاكتشاف أي تراجعات في التنسيق.

## Nitro وأهداف النشر

- **node-server**، تعمل مسارات الخادم كمعالج HTTP في Node.js. أضف قاعدة تخزين مؤقت
في الوكيل العكسي (nginx/Caddy) من أجل `/llms.txt` لتجنب تشغيل Node عند كل طلب. 
- **cloudflare-pages**, الملفات الثابتة في `public/` تُقدَّم عبر شبكة CDN
العالمية التابعة لـ Cloudflare. وتصبح مسارات الخادم Pages Functions. راجع [دليل Cloudflare](/ar/llms-txt-cloudflare/) لترويسات التخزين المؤقت. 
- **vercel**, وتخزّن الملفات الثابتة مؤقتاً عند الحافة تلقائياً. وتصبح مسارات
الخادم وظائف Vercel Serverless أو Edge وفق الإعداد. 
- **ثابت** (معروض مسبقاً بالكامل)، فاستخدم `public/` 
نهج الملف الثابت؛ فمسارات الخادم غير متاحة في إخراج ثابت بحت.   
## تحقّق

بعد النشر، تأكد من تقديم الملف بصورة صحيحة:
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
# Should print the first lines of your file
```

## أدلة ذات صلة

- [كيفية إنشاء llms.txt](/ar/how-to-create/), والقوالب وقائمة الفحص. 
- [مرجع تنسيق llms.txt](/ar/llms-txt-format/), تفاصيل المواصفة. 
- [دليل Vercel](/ar/llms-txt-vercel/), والنشر ورؤوس التخزين المؤقت. 
- [دليل Cloudflare Pages](/ar/llms-txt-cloudflare/), وإعداد CDN. 
- [المدقّق](/ar/validator/) · [المولّد](/ar/generator/).        
## المصادر

- [ llmstxt.org، اقتراح المجتمع ](https://llmstxt.org/)
- [ توثيق Nuxt، ومسارات الخادم ](https://nuxt.com/docs/guide/directory-structure/server)
- [ توثيق Nuxt Content ](https://content.nuxt.com/)
