diff --git a/Controller/StaticController.php b/Controller/StaticController.php index 4211f57..fdd571b 100755 --- a/Controller/StaticController.php +++ b/Controller/StaticController.php @@ -35,7 +35,7 @@ class StaticController extends Controller */ public function rootAction() { - return $this->render('@KaliopTwigExpress/root.html.twig', [ + return $this->render('@KaliopTwigExpress/rootindex.html.twig', [ 'bundles' => $this->container->getParameter('twig_express.bundles') ]); } @@ -155,7 +155,7 @@ private function renderDir($dirPath, $urlFragment) ]; } - return $this->render('@KaliopTwigExpress/layout.html.twig', [ + return $this->render('@KaliopTwigExpress/dirindex.html.twig', [ 'breadcrumbs' => $breadcrumbs, 'dirList' => $dirList, 'fileList' => $fileList, diff --git a/Resources/demo/function-lorem.twig b/Resources/demo/function-lorem.twig index 2da1475..c95a57c 100644 --- a/Resources/demo/function-lorem.twig +++ b/Resources/demo/function-lorem.twig @@ -1,7 +1,8 @@ {% extends twigexpress_layout() %} +{% set metaTitle = 'The lorem() function' %} {% block content %} -

Twig function: lorem

+

The lorem() function

Output a string: words, sentences, paragraphs

diff --git a/Resources/demo/function-markdown.twig b/Resources/demo/function-markdown.twig index b12138f..4ed2729 100644 --- a/Resources/demo/function-markdown.twig +++ b/Resources/demo/function-markdown.twig @@ -1,7 +1,8 @@ {% extends twigexpress_layout() %} +{% set metaTitle = 'The markdown() function' %} {% block content %} -

Twig function: markdown

+

The markdown() function

markdown('Hello *world*!')

diff --git a/Resources/demo/function-param.twig b/Resources/demo/function-param.twig index 811ca99..5a1c936 100644 --- a/Resources/demo/function-param.twig +++ b/Resources/demo/function-param.twig @@ -1,7 +1,8 @@ {% extends twigexpress_layout() %} +{% set metaTitle = 'The param() function' %} {% block content %} -

Twig function: param

+

The param() function

Default: GET values

diff --git a/Resources/demo/index.twig b/Resources/demo/index.twig index b9b8288..5de0cb7 100644 --- a/Resources/demo/index.twig +++ b/Resources/demo/index.twig @@ -1,4 +1,6 @@ {% extends twigexpress_layout() %} +{% set metaTitle = 'KaliopTwigExpressBundle features' %} + {% set links = [ {name: 'function-lorem', label:'The lorem() function'}, {name: 'function-markdown', label:'The markdown() function'}, diff --git a/Resources/views/dirindex.html.twig b/Resources/views/dirindex.html.twig new file mode 100644 index 0000000..ed25607 --- /dev/null +++ b/Resources/views/dirindex.html.twig @@ -0,0 +1,11 @@ +{% extends '@KaliopTwigExpress/layout.html.twig' %} + +{# Use breadcrumbs parts for the tab title #} +{% set metaTitle = '' %} +{% if breadcrumbs is defined %} + {% if breadcrumbs|length == 1 %} + {% set metaTitle = breadcrumbs[0].name %} + {% elseif breadcrumbs|length > 1 %} + {% set metaTitle = (breadcrumbs|last).name ~ ' - ' ~ breadcrumbs[0].name %} + {% endif %} +{% endif %} diff --git a/Resources/views/layout.html.twig b/Resources/views/layout.html.twig index 1887341..2962c9c 100644 --- a/Resources/views/layout.html.twig +++ b/Resources/views/layout.html.twig @@ -14,7 +14,7 @@ {# Header content #} {% set title = title|default('') %} - {% set metaTitle = metaTitle|default(title)|default('') %} + {% set metaTitle = metaTitle|default(title) %} {% set message = message|default('') %} {% endspaceless %} @@ -24,7 +24,7 @@ - {% if metaTitle ?? false %}{{ metaTitle }}{% endif %} + {{ metaTitle|default('') }} diff --git a/Resources/views/root.html.twig b/Resources/views/rootindex.html.twig similarity index 100% rename from Resources/views/root.html.twig rename to Resources/views/rootindex.html.twig