llms.txt in Angular
Serving llms.txt from an Angular app takes one file in the public/ folder, no configuration.
Last updated:
Where the file goes
Since Angular 17, the CLI scaffolds a public/ folder at the project root. Everything
inside it is copied verbatim to the build output root, so a file at public/llms.txt is
served at https://yourdomain.com/llms.txt with no extra configuration.
Method: the public/ folder
- Create the folder if it does not exist:
mkdir -p public - Add the file:
touch public/llms.txt - Write your content (see the how-to guide and generator for the format):
# Your Site Name
> One-sentence description of your site for LLM context.
## Core pages
- [Page title](https://yourdomain.com/page/): brief description.
- [Another page](https://yourdomain.com/other/): brief description.
- Build and deploy:
ng build. The file lands at the output root.
Older projects (assets array)
Angular projects created before v17 use src/assets/ plus the assets array
in
angular.json. Files there are served under /assets/, not the root,
which is the wrong location for llms.txt. The cleanest fix is to add a public/ folder and ensure it is listed in the assets array (newer CLI configs include it by
default):
// angular.json (build options)
"assets": [
{ "glob": "**/*", "input": "public" }
]
This copies public/llms.txt to the output root, served at /llms.txt.
Verifying the setup
After deploying, open https://yourdomain.com/llms.txt in a browser. It should load as
plain text. You can also confirm the content type from the terminal:
curl -sI https://yourdomain.com/llms.txt | grep -i content-type
# expect: content-type: text/plain
Next: keep the file in sync with your real pages, and consider a fuller
llms-full.txt. Not sure the format is right? Run it
through the
validator. See also the Vercel and
Netlify guides for host-specific notes.