Skip to content

Commit 6e4f4ec

Browse files
committed
Add static page for contact, update routes from /page/contact/ -> /contact/
1 parent e4cbe1e commit 6e4f4ec

5 files changed

Lines changed: 62 additions & 30 deletions

File tree

src/App/src/RoutesDelegator.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Light\App;
66

7+
use Laminas\Diactoros\Response\RedirectResponse;
78
use Light\App\Handler\GetIndexViewHandler;
89
use Mezzio\Application;
910
use Psr\Container\ContainerInterface;
@@ -17,6 +18,16 @@ public function __invoke(ContainerInterface $container, string $serviceName, cal
1718
$app = $callback();
1819
assert($app instanceof Application);
1920
$app->get('/', [GetIndexViewHandler::class], 'app::index');
21+
22+
$app->get('/{first}', function ($request) {
23+
$uri = $request->getUri();
24+
return new RedirectResponse((string) $uri . '/', 301);
25+
});
26+
$app->get('/{first}/{second}', function ($request) {
27+
$uri = $request->getUri();
28+
return new RedirectResponse((string) $uri . '/', 301);
29+
});
30+
2031
return $app;
2132
}
2233
}

src/Blog/src/RoutesDelegator.php

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace Light\Blog;
66

7-
use Laminas\Diactoros\Response\RedirectResponse;
87
use Light\Blog\Handler\GetAuthorResourceHandler;
98
use Light\Blog\Handler\GetCategoryCollectionHandler;
109
use Light\Blog\Handler\GetCategoryResourceHandler;
@@ -21,37 +20,11 @@ public function __invoke(ContainerInterface $container, string $serviceName, cal
2120
{
2221
$app = $callback();
2322
assert($app instanceof Application);
24-
2523
$app->get('/blog/', [GetPostCollectionHandler::class], 'page::blog');
26-
$app->get('/blog', function ($request) {
27-
$uri = $request->getUri();
28-
return new RedirectResponse((string) $uri . '/', 301);
29-
});
30-
3124
$app->get('/category/{slug}/', [GetCategoryResourceHandler::class], 'page::category-resource');
32-
$app->get('/category/{slug}', function ($request) {
33-
$uri = $request->getUri();
34-
return new RedirectResponse((string) $uri . '/', 301);
35-
});
36-
3725
$app->get('/categories/', [GetCategoryCollectionHandler::class], 'page::categories');
38-
$app->get('/categories', function ($request) {
39-
$uri = $request->getUri();
40-
return new RedirectResponse((string) $uri . '/', 301);
41-
});
42-
4326
$app->get('/author/{slug}/', [GetAuthorResourceHandler::class], 'page::author-resource');
44-
$app->get('/author/{slug}', function ($request) {
45-
$uri = $request->getUri();
46-
return new RedirectResponse((string) $uri . '/', 301);
47-
});
48-
4927
$app->get('/{categorySlug}/{slug}/', [GetPostResourceHandler::class], 'page::blog-resource');
50-
$app->get('/{categorySlug}/{slug}', function ($request) {
51-
$uri = $request->getUri();
52-
return new RedirectResponse((string) $uri . '/', 301);
53-
});
54-
5528
return $app;
5629
}
5730
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{% extends '@layout/default.html.twig' %}
2+
3+
{% block page_title %}<h1>Contact Us</h1>{% endblock %}
4+
5+
{% block content %}
6+
<div class="row g-4 py-3 justify-content-center">
7+
<div class="col-12 col-md-6 col-lg-6">
8+
<div class="card h-100 border-0 shadow-sm text-center p-4">
9+
<div class="mb-3">
10+
<i class="fab fa-github fa-3x text-primary"></i>
11+
</div>
12+
<h2 class="h4 fw-semibold mb-2">GitHub</h2>
13+
<p class="text-muted mb-4">
14+
Browse our repositories, open issues, or contribute to the DotKernel ecosystem.
15+
</p>
16+
<a href="https://github.com/dotkernel"
17+
target="_blank"
18+
rel="noopener noreferrer"
19+
class="btn btn-primary rounded-pill px-4 mt-auto">
20+
Visit GitHub
21+
</a>
22+
</div>
23+
</div>
24+
<div class="col-12 col-md-6 col-lg-6">
25+
<div class="card h-100 border-0 shadow-sm text-center p-4">
26+
<div class="mb-3">
27+
<i class="fas fa-book fa-3x text-primary"></i>
28+
</div>
29+
<h2 class="h4 fw-semibold mb-2">Documentation</h2>
30+
<p class="text-muted mb-4">
31+
Read the guides, references, and best practices for building with DotKernel.
32+
</p>
33+
<a href="https://docs.dotkernel.org/"
34+
target="_blank"
35+
rel="noopener noreferrer"
36+
class="btn btn-primary rounded-pill px-4 mt-auto">
37+
Read the Docs
38+
</a>
39+
</div>
40+
</div>
41+
<hr>
42+
<h3>Our Approach</h3>
43+
<p>
44+
Dotkernel is a Headless Platform for building modern web applications.
45+
46+
The Dotkernel Headless Platform is made up of Open Source components aimed at businesses that need custom solutions.</p>
47+
</div>
48+
{% endblock %}

src/Page/src/RoutesDelegator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function __invoke(ContainerInterface $container, string $serviceName, cal
2828
foreach ($routes as $prefix => $moduleRoutes) {
2929
foreach ($moduleRoutes as $routeUri => $templateName) {
3030
$app->get(
31-
sprintf('/%s/%s', $prefix, $routeUri),
31+
sprintf('/%s/', $routeUri),
3232
GetPageViewHandler::class,
3333
sprintf('%s::%s', $prefix, $templateName)
3434
);

test/Unit/Page/RoutesDelegatorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ class RoutesDelegatorTest extends TestCase
2525
*/
2626
public function testWillInvoke(): void
2727
{
28-
$moduleName = 'test';
28+
$moduleName = 'test_module_name';
2929
$routeName = 'test_route_name';
30-
$routeUri = sprintf('/%s/%s', $moduleName, $routeName);
30+
$routeUri = sprintf('/%s/', $routeName);
3131
$templateName = sprintf('%s::%s', $moduleName, $routeName);
3232

3333
$container = $this->createStub(ContainerInterface::class);

0 commit comments

Comments
 (0)