diff --git a/config/autoload/headers.global.php b/config/autoload/headers.global.php new file mode 100644 index 0000000..e56a1b2 --- /dev/null +++ b/config/autoload/headers.global.php @@ -0,0 +1,73 @@ +; rel="llms-txt", ; rel="llms-full-txt"'; +$serviceDocLink = static fn (string $url): string => sprintf('<%s>; rel="service-doc", ', $url) . $llmsTxtLink; + +return [ + 'dot_response_headers' => [ + '*' => [ + 'X-Powered-By' => [ + 'value' => 'Dotkernel', + 'overwrite' => true, + ], + 'X-Llms-Txt' => [ + 'value' => '/llms.txt', + 'overwrite' => true, + ], + 'Link' => [ + 'value' => $llmsTxtLink, + 'overwrite' => true, + ], + ], + 'app::index' => [ + 'Link' => [ + 'value' => $serviceDocLink('https://docs.dotkernel.org/'), + 'overwrite' => true, + ], + ], + 'page::api' => [ + 'Link' => [ + 'value' => $serviceDocLink('https://docs.dotkernel.org/api-documentation/'), + 'overwrite' => true, + ], + ], + 'page::admin' => [ + 'Link' => [ + 'value' => $serviceDocLink('https://docs.dotkernel.org/admin-documentation/'), + 'overwrite' => true, + ], + ], + 'page::queue' => [ + 'Link' => [ + 'value' => $serviceDocLink('https://docs.dotkernel.org/queue-documentation/'), + 'overwrite' => true, + ], + ], + 'page::light' => [ + 'Link' => [ + 'value' => $serviceDocLink('https://docs.dotkernel.org/light-documentation/'), + 'overwrite' => true, + ], + ], + 'page::frontend' => [ + 'Link' => [ + 'value' => $serviceDocLink('https://docs.dotkernel.org/frontend/'), + 'overwrite' => true, + ], + ], + 'page::wsl2' => [ + 'Link' => [ + 'value' => $serviceDocLink('https://docs.dotkernel.org/development/v2/terminal/'), + 'overwrite' => true, + ], + ], + 'page::architecture' => [ + 'Link' => [ + 'value' => $serviceDocLink('https://docs.dotkernel.org/api-documentation/'), + 'overwrite' => true, + ], + ], + ], +]; diff --git a/config/autoload/local.php.dist b/config/autoload/local.php.dist index 57fc88e..3cd2b2e 100644 --- a/config/autoload/local.php.dist +++ b/config/autoload/local.php.dist @@ -47,35 +47,19 @@ $app = [ ]; return [ - 'application' => $app, - 'databases' => $databases, - 'dot_response_headers' => [ - '*' => [ - 'X-Powered-By' => [ - 'value' => $app['meta']['siteName'], - 'overwrite' => true, - ], - 'X-Llms-Txt' => [ - 'value' => '/llms.txt', - 'overwrite' => true, - ], - 'Link' => [ - 'value' => '; rel="llms-txt", ; rel="llms-full-txt"', - 'overwrite' => true, - ], - ], - ], - 'doctrine' => [ + 'application' => $app, + 'databases' => $databases, + 'doctrine' => [ 'connection' => [ 'orm_default' => [ 'params' => $databases['default'], ], ], ], - 'feed' => [ + 'feed' => [ 'path' => realpath(__DIR__ . '/../../public/feed.xml'), ], - 'llms' => [ + 'llms' => [ 'sourceDir' => realpath(__DIR__ . '/../../public/md-articles'), 'outputFile' => realpath(__DIR__ . '/../../public/llms-full.txt'), // Markdown versions of the static pages, appended after the articles. Optional. diff --git a/config/pipeline.php b/config/pipeline.php index ba6c27c..6640698 100644 --- a/config/pipeline.php +++ b/config/pipeline.php @@ -41,7 +41,6 @@ // Register the routing middleware in the middleware pipeline. // This middleware registers the Mezzio\Router\RouteResult request attribute. $app->pipe(RouteMiddleware::class); - $app->pipe(ResponseHeaderMiddleware::class); // The following handle routing failures for common conditions: // - HEAD request but no routes answer that method @@ -52,6 +51,7 @@ $app->pipe(ImplicitHeadMiddleware::class); $app->pipe(ImplicitOptionsMiddleware::class); $app->pipe(MethodNotAllowedMiddleware::class); + $app->pipe(ResponseHeaderMiddleware::class); // Seed the UrlHelper with the routing results: $app->pipe(UrlHelperMiddleware::class);