Skip to content

Commit

Permalink
Add <title> to index and demo pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Florens Verschelde committed Jun 12, 2017
1 parent 2cd335f commit 9acd782
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Controller/StaticController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
]);
}
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion Resources/demo/function-lorem.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{% extends twigexpress_layout() %}
{% set metaTitle = 'The lorem() function' %}

{% block content %}
<h1>Twig function: <code>lorem</code></h1>
<h1>The <code>lorem()</code> function</h1>

<h2>Output a string: words, sentences, paragraphs</h2>

Expand Down
3 changes: 2 additions & 1 deletion Resources/demo/function-markdown.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{% extends twigexpress_layout() %}
{% set metaTitle = 'The markdown() function' %}

{% block content %}
<h1>Twig function: <code>markdown</code></h1>
<h1>The <code>markdown()</code> function</h1>

<h2><code>markdown('Hello *world*!')</code></h2>
<blockquote class="TestResult">
Expand Down
3 changes: 2 additions & 1 deletion Resources/demo/function-param.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{% extends twigexpress_layout() %}
{% set metaTitle = 'The param() function' %}

{% block content %}
<h1>Twig function: <code>param</code></h1>
<h1>The <code>param()</code> function</h1>

<h2 id="get-demo">Default: GET values</h2>

Expand Down
2 changes: 2 additions & 0 deletions Resources/demo/index.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{% extends twigexpress_layout() %}
{% set metaTitle = 'KaliopTwigExpressBundle features' %}

{% set links = [
{name: 'function-lorem', label:'The <code>lorem()</code> function'},
{name: 'function-markdown', label:'The <code>markdown()</code> function'},
Expand Down
11 changes: 11 additions & 0 deletions Resources/views/dirindex.html.twig
Original file line number Diff line number Diff line change
@@ -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 %}
4 changes: 2 additions & 2 deletions Resources/views/layout.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand All @@ -24,7 +24,7 @@
<meta charset="UTF-8">
<meta name="robots" content="noindex">
<meta name="viewport" content="width=device-width">
{% if metaTitle ?? false %}<title>{{ metaTitle }}</title>{% endif %}
<title>{{ metaTitle|default('') }}</title>
<style>.icon{width:1em;height:1em;}</style>
</head>
<body>
Expand Down
File renamed without changes.

0 comments on commit 9acd782

Please sign in to comment.