This site provides a machine-readable index at /llms.txt.

Skip to main content Skip to navigation

LlmsTxtMiddleware Pennington.LlmsTxt

Intercepts requests for per-subtree {prefix}llms.txt and per-page {OutputDirectory}/{path}.md sidecars before endpoint routing has a chance to claim them. Without this, request paths like /reference/api/llms.txt get caught by the API-reference Razor route (whose {slug} segment matches llms.txt).

Constructors

.ctor

#
public LlmsTxtMiddleware(RequestDelegate next, LlmsTxtOptions options);

Initializes the middleware.

Parameters

next RequestDelegate
options LlmsTxtOptions

Methods

InvokeAsync

#
public async Task InvokeAsync(HttpContext context, LlmsTxtService service);

Serves a subtree or sidecar file when the request path matches one; otherwise calls the next middleware.

Parameters

context HttpContext
service LlmsTxtService

Returns

Task

Pennington.LlmsTxt.LlmsTxtMiddleware

namespace Pennington.LlmsTxt;

/// Intercepts requests for per-subtree {prefix}llms.txt and per-page {OutputDirectory}/{path}.md sidecars before endpoint routing has a chance to claim them. Without this, request paths like /reference/api/llms.txt get caught by the API-reference Razor route (whose {slug} segment matches llms.txt).
public class LlmsTxtMiddleware
{
    /// Initializes the middleware.
    
public LlmsTxtMiddleware(RequestDelegate next, LlmsTxtOptions options);
/// Serves a subtree or sidecar file when the request path matches one; otherwise calls the next middleware.
public async Task InvokeAsync(HttpContext context, LlmsTxtService service);
}