

llms.txt 的用途
介紹 llms.txt 的由來、格式範例與實際應用,解析其如何協助大型語言模型(LLM)更精確理解網站內容。內容涵蓋技術部署、潛在效益、限制與未來展望,並探討 llms.txt 對技術文件、電商、部落格等不同網站型態的優化建議,是網站管理者與開發者不可錯過的最新趨勢解析。
最近像是 ChatGPT、Grok、perplexity 等等的 LLM 或者是 MCP 都開始新增網頁搜爬的功能,只要簡單的需求,AI 工具就會開始上網查找資料並做摘要解析,讓使用者快速獲得所需資訊。
也因為這個趨勢,未來要讓 AI 更快速的解析網站也會變成一門必修課題。在很多網站都還是使用 div 未使用語意化的標籤,就會讓 AI 有困難去辨識。
為了解決這個問題,llms.txt 的概念被提出,就像是 robots.txt 的概念。
llms.txt 是什麼#
llms.txt 是由 Jeremy Howard 提出,建議在網站的根目錄下放置一個 llms.txt
檔案,內容會是 Markdown 格式,用來告訴 LLM 這個網站的重要資訊
像是網站名稱 (H1)、網站的簡介 (blockquote)、各個重要資源的連結、範例等等。讓 AI 能够精準的了解並且回傳正確的資訊。
雖然目前沒有 LLM 的正式確定會使用該標準,但已經有幾個名氣較大的 AI 相關組織開始採用,像是 Anthropic、HuggingFace 等等。
llms.txt 的格式#
llms.txt 的格式是 Markdown 格式,就像是 LLM 進入網站後,會參考的文件,效果會比由 AI 解析原始碼來的精準。
- H1 為網站的標題。
- Blockquote 為網站的簡介。
- H2 會寫各區塊的標題,並配上該區塊的連結。
# 網站名稱
> 這是個 llms 的範例檔案
## 資源
- [資源 1](https://example.com/resource-1)
- [資源 2](https://example.com/resource-2)
markdown而 llms.txt 又有分精簡版本以及將所有資料彙整的 llms-full.txt,以 Perplexity 的官方文件為例,在精簡版中,只放上了各個重要單元的連結。
# Perplexity
## Docs
- [Chat Completions](https://docs.perplexity.ai/api-reference/chat-completions.md): Generates a model's response for the given chat conversation.
- [Changelog](https://docs.perplexity.ai/changelog/changelog.md)
- [Community & Support](https://docs.perplexity.ai/discussions/discussions.md)
- [Frequently Asked Questions](https://docs.perplexity.ai/faq/faq.md)
- [API Roadmap](https://docs.perplexity.ai/feature-roadmap.md): Upcoming features and improvements for the Perplexity API designed to enhance your development experience.
- [API Group](https://docs.perplexity.ai/guides/api-organization.md): Learn how to use the Perplexity API Portal to manage access, usage, billing, and team collaboration.
- [Perplexity Crawlers](https://docs.perplexity.ai/guides/bots.md): We strive to improve our service every day by delivering the best search experience possible. To achieve this, we collect data using web crawlers (“robots”) and user agents that gather and index information from the internet, operating either automatically or in response to user requests. Webmasters can use the following robots.txt tags to manage how their sites and content interact with Perplexity. Each setting works independently, and it may take up to 24 hours for our systems to reflect changes.
// 以下省略
markdown在完整版中,會將所有資料彙整成一筆 markdown 格式,並且也可以加入一些指令 (類似於 system prompt),讓 LLM 能參照你的想法來做讀取。
# Chat Completions
Source: https://docs.perplexity.ai/api-reference/chat-completions
post /chat/completions
Generates a model's response for the given chat conversation.
# Changelog
Source: https://docs.perplexity.ai/changelog/changelog
<AccordionGroup>
<Accordion title="Image uploads now available for all users!" description="April 2025">
You can now upload images to Sonar and use them as part of your multimodal search experience.\
Give it a try by following our image upload guide:\
[https://docs.perplexity.ai/guides/image-guide](https://docs.perplexity.ai/guides/image-guide)
</Accordion>
// 以下省略
markdownllms.txt 線上產生工具#
將網址貼入後,工具就會進行頁面的解析並產出 llms.txt 的檔案,也可以選擇是否產生 llms-full.txt 的檔案。
建議加上的網站類型#
- 技術文件網站:因為 AI 的出現,在開發上也變得更加地容易,大大的減少了閱讀文檔的時間,而要讓 LLM 表現得更好,就會需要透過 llms.txt 的方式來告知 LLM 如何檢索這份文件。
- 電商網站:可以使用 llms.txt 來提供產品目錄以及產品資訊還有相關的常見問題。讓使用者透過 AI 就能夠準確的認識產品
- 個人部落格:和技術網站相同,透過目錄的方式,讓 AI 能够快速的找到文章的內容。
llms.txt 對 SEO 有幫助嗎#
雖然目前並沒有實質的證明可以佐證對於 SEO 有顯著的幫助,但可以確定的是,這麼做可以讓 AI 避開一些廣告或無用的程式碼來干擾正確的資訊進而產生誤導的回應。
也能夠透過 llms-full.txt 的補充,提升 AI 檢索的效率,他能夠更快更精準地找到在哪個頁面被提及。對於 GEO 來說可能會有一定的幫助。
llms.txt 的限制#
目前 llms.txt 還只是提出的標準,並沒有正式被所有的 AI 工具所採用,LLM 是否會做參考也是未知數,並沒有強制力。
所以沒辦法做到像是 robots.txt 限制爬蟲存取的頁面來停止網站的內容受到模型的訓練。僅能透過 llms-full.txt 新增不希望被模型訓練的提示詞請有參考的 LLM 做遵守。