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
nextRequestDelegateoptionsLlmsTxtOptions
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
contextHttpContextserviceLlmsTxtService
Returns
TaskPennington.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);
}