generate
llms.txt
–using yoursitemap.xml
.
$ npx -y llmstxt gen https://dotenvx.com/sitemap.xml
-
expand example
$ npx -y llmstxt gen https://dotenvx.com/sitemap.xml - [dotenvx run -f](https://dotenvx.com/docs/advanced/run-f.html): Compose multiple .env files for environment variables loading, as you need. - [dotenvx run --log-level](https://dotenvx.com/docs/advanced/run-log-level.html): Set `--log-level` to whatever you wish. - [dotenvx run --env HELLO=String](https://dotenvx.com/docs/advanced/run-overload.html): Override existing env variables. These can be variables already on your machine or variables loaded as files consecutively. The last variable seen will 'win'. - [dotenvx run --quiet](https://dotenvx.com/docs/advanced/run-quiet.html): Use `--quiet` to suppress all output (except errors). - [dotenvx run - Shell Expansion](https://dotenvx.com/docs/advanced/run-shell-expansion.html): Prevent your shell from expanding inline `$VARIABLES` before dotenvx has a chance to inject them. Use a subshell. ...
Basic usage
-
`gen https://yoursite.com/sitemap.xml`
Outputs to stdout.
$ llmstxt gen https://dotenvx.com/sitemap.xml - [dotenvx run -f](https://dotenvx.com/docs/advanced/run-f.html): Compose multiple .env files for environment variables loading, as you need. - [dotenvx run --log-level](https://dotenvx.com/docs/advanced/run-log-level.html): Set `--log-level` to whatever you wish. - [dotenvx run --quiet](https://dotenvx.com/docs/advanced/run-quiet.html): Use `--quiet` to suppress all output (except errors). ...
-
`gen https://yoursite.com/sitemap.xml > llms.txt`
Write to file.
$ llmstxt gen https://dotenvx.com/sitemap.xml > llms.txt
Advanced options
-
`gen --exclude-path` - Exclude path(s)
Exclude paths from generation.
# exclude all blog posts $ llmstxt gen https://dotenvx.com/sitemap.xml --exclude-path "**/blog/**" # exclude all docs $ llmstxt gen https://dotenvx.com/sitemap.xml --exclude-path "**/docs/**" # exclude privacy and terms $ llmstxt gen https://dotenvx.com/sitemap.xml -ep "**/privacy**" -ep "**/terms**"
-
`gen --include-path` - Include path(s)
Include paths for generation.
# include all docs only $ llmstxt gen https://dotenvx.com/sitemap.xml --include-path "**/docs/**" # include all blogs only $ llmstxt gen https://dotenvx.com/sitemap.xml -ip "**/blog/**"
-
`gen --replace-title s/pattern/replacement/` - Replace string(s) from title
Use
--replace-title
to remove redundant text from your page titles. For example, dotenvx's titles all end with| dotenvx
. I want to replace those with empty string.$ llmstxt gen https://dotenvx.com/sitemap.xml --replace-title 's/\| dotenvx//'
-
`gen --title 'Your Heading'` - set title
Set your website's heading 1 title.
$ llmstxt gen https://dotenvx.com/sitemap.xml --title 'dotenvx'
-
`gen --description 'Some description'` - set description
Set your website's description.
$ llmstxt gen https://dotenvx.com/sitemap.xml --description 'This is a description'
I'm using it to generate dotenvx.com/llms.txt with the following command:
npx -y llmstxt@latest gen https://dotenvx.com/sitemap.xml -ep "**/privacy**" -ep "**/terms**" -ep "**/blog/**" -ep "**/stats/**" -ep "**/support/**" -rt 's/\| dotenvx//' -t 'dotenvx' > llms.txt