<!-- 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: ملف ثابت في public/ (بلا إعداد)، أو مسار خادم Nitro للتوليد الديناميكي، أو مسار خادم يستعلم عن مجموعات Nuxt Content v3، أو الوحدة nuxt-llms.

آخر تحديث: 29 أكتوبر 2026

في هذه الصفحة

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

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

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

## الخيار 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((event) => {
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 الاستجابة مؤقتاً وتخفف الحمل عن المصدر.

لا يكتشف زاحف التصيير المسبق إلا المسارات المرتبطة من صفحاتك، لذا لا يُصيَّر مسار خادم مثل
`/llms.txt` مسبقاً بصورة تلقائية. ولإخراجه كملف ثابت وقت البناء، أضف قاعدة مسار (أو أدرجه
في المصفوفة `prerender.routes`، كما يوضح توثيق Nuxt بالنسبة إلى
`/sitemap.xml` و`/robots.txt`):
nuxt.config.ts, prerender /llms.txt    نسخ     

```
// nuxt.config.ts
// Prerender the server route so it is written as a static file at build time.
export default defineNuxtConfig({
routeRules: {
'/llms.txt': { prerender: true },
},
});

```

## الخيار 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 v3 documents.
// 'docs' must be a collection defined in content.config.ts.
export default defineEventHandler(async (event) => {
// Server-side, queryCollection takes the event as its first argument
const docs = await queryCollection(event, 'docs')
.select('path', 'title', 'description')
.all();

const links = docs
.map((doc) => `- [${doc.title}](https://yoursite.com${doc.path}): ${doc.description ?? ''}`.trimEnd())
.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;
});

```

يستخدم هذا واجهة Nuxt Content v3 البرمجية. فقد حلّت `queryCollection()` محل
`queryContent()` و`serverQueryContent()` في Content v2، وهي تستعلم عن مجموعة
معرّفة في `content.config.ts`، كما أصبح الحقل `_path` الآن
`path`. اضبط اسم المجموعة (`docs`) والحقول المحددة لتطابق بنية محتواك.
شغّل [المدقّق](/ar/validator/) بعد النشر لاكتشاف أي تراجعات في التنسيق.

## الخيار 4: الوحدة nuxt-llms

تولّد الوحدة `nuxt-llms` (المنشورة ضمن منظمة GitHub `nuxt-content`؛ وقد
صدر الإصدار 0.3.1 في 27 أكتوبر 2026) الملف `llms.txt` انطلاقاً من الإعداد. وعند تثبيتها
إلى جانب Nuxt Content v3، يحقن Nuxt Content مجموعاته من نوع `page` في الوحدة، ويذكر توثيق
Nuxt Content أن `/llms.txt` يُولَّد حينئذ ويُصيَّر مسبقاً تلقائياً. ثبّتها باستخدام
`npm install nuxt-llms`، ثم:
nuxt.config.ts, nuxt-llms    نسخ     

```
// nuxt.config.ts
export default defineNuxtConfig({
modules: ['@nuxt/content', 'nuxt-llms'],
llms: {
domain: 'https://your-site.com',
title: 'Your Site Name',
description: 'A brief description of your site',
},
});

```

يمكن إعداد الأقسام ومرشّحات المحتوى ضمن `llms.sections`؛ راجع [تكامل Nuxt Content مع LLMs](https://content.nuxt.com/docs/integrations/llms) للاطلاع على الخيارات.

## 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 وفق الإعداد. 
- **ثابت** (معروض مسبقاً بالكامل، على سبيل المثال باستخدام `nuxt generate`)، يعمل ملف `public/` كما هو. ولا يُضمَّن مسار الخادم في الإخراج الثابت إلا إذا صُيِّر
مسبقاً: أضفه إلى `routeRules` مع `prerender: true` أو إلى
`prerender.routes`، كما هو موضح في الخيار 2.   
## تحقّق

بعد النشر، تأكد من تقديم الملف بصورة صحيحة:
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 (4.x)، ودليل الخادم ](https://nuxt.com/docs/4.x/directory-structure/server)
- [ توثيق Nuxt (4.x)، والتصيير المسبق ](https://nuxt.com/docs/4.x/getting-started/prerendering)
- [ توثيق Nuxt Content ](https://content.nuxt.com/)
- [ Nuxt Content، وqueryCollection ](https://content.nuxt.com/docs/utils/query-collection)
- [ Nuxt Content، والترحيل من v2 ](https://content.nuxt.com/docs/getting-started/migration)
- [ Nuxt Content، والتكامل مع وحدة LLMs ](https://content.nuxt.com/docs/integrations/llms)
- [ الشيفرة المصدرية لـ nuxt-llms ](https://github.com/nuxt-content/nuxt-llms)
