Skip to content

Commit 7549cd0

Browse files
committed
feat(CatchAllController): Add blog post template rendering and new blog-detail.twig file
1 parent a970108 commit 7549cd0

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

examples/dotcms-symfony/src/Controller/CatchAllController.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,12 @@ public function show(string $path = ''): Response
4848
// Get navigation with depth of 2 (top level + one level of children)
4949
$navigation = $this->dotCMSService->getNavigation('/', 2);
5050

51-
return $this->render('page.html.twig', [
51+
// Check if this is a blog post URL pattern
52+
$isBlogPost = preg_match('/^\/blog\/post\/[^\/]+\/?$/', $actualPath);
53+
54+
$template = $isBlogPost ? 'blog-detail.html.twig' : 'page.html.twig';
55+
56+
return $this->render($template, [
5257
'pageAsset' => $pageAsset,
5358
'layout' => $pageAsset->layout ?? null,
5459
'page' => $pageAsset->page ?? null,
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{% extends 'base.html.twig' %}
2+
3+
{% block title %}{{ pageAsset.page.title|default('Blog Post') }}{% endblock %}
4+
5+
{% block body %}
6+
{% include 'dotcms/header.twig' %}
7+
8+
<div class="container">
9+
<div class="row">
10+
<div class="col-start-1 col-end-13">
11+
<article>
12+
<h1>{{ pageAsset.page.title }}</h1>
13+
</article>
14+
</div>
15+
</div>
16+
</div>
17+
{% endblock %}

0 commit comments

Comments
 (0)