Browse Source

On passe le titre en env

Sangfroid 2 months ago
parent
commit
fe0e512aaf

+ 2 - 0
.env

@@ -39,3 +39,5 @@ MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
 ###> symfony/mailer ###
 # MAILER_DSN=null://null
 ###< symfony/mailer ###
+
+TITLE="Opinion sur le réel"

+ 2 - 0
config/packages/twig.yaml

@@ -1,5 +1,7 @@
 twig:
     file_name_pattern: '*.twig'
+    globals:
+        site_title: '%title%'
 
 when@test:
     twig:

+ 1 - 0
config/services.yaml

@@ -5,6 +5,7 @@
 # https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
 parameters:
     images_directory: '%kernel.project_dir%/public/uploads/images'
+    title: '%env(TITLE)%'
 services:
     # default configuration for services in *this* file
     _defaults:

+ 1 - 1
templates/_menu.html.twig

@@ -1,6 +1,6 @@
 <header id="header">
     <nav class="navbar" data-controller="menuburger">
-        <a href="{{ path('app_index') }}" class="logo">Opinion sur le réel</a>
+        <a href="{{ path('app_index') }}" class="logo">{{ site_title }}</a>
         <div class="nav-links" data-menuburger-target="navlinks">
             <ul>
                 <li><a href="{{ path('app_index') }}">Blog</a></li>

+ 1 - 1
templates/base.html.twig

@@ -3,7 +3,7 @@
     <head>
         <meta charset="UTF-8">
         <meta name="viewport" content="width=device-width, initial-scale=1">
-        <title>{% block title %}Welcome!{% endblock %}</title>
+        <title>{% block title %}{{ site_title }}{% endblock %}</title>
         <link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text><text y=%221.3em%22 x=%220.2em%22 font-size=%2276%22 fill=%22%23fff%22>sf</text></svg>">
         {% block stylesheets %}
         {% endblock %}

+ 1 - 1
templates/index/index.html.twig

@@ -1,6 +1,6 @@
 {% extends 'base.html.twig' %}
 
-{% block title %}Opinion sur le réel{% endblock %}
+{% block title %}{{ parent() }} - Blog{% endblock %}
 
 {% block body %}
 

+ 1 - 1
templates/page/index.html.twig

@@ -1,6 +1,6 @@
 {% extends 'base.html.twig' %}
 
-{% block title %}Page contact{% endblock %}
+{% block title %}{{ parent() }} - {{ page.title }}{% endblock %}
 
 {% block body %}
 

+ 1 - 1
templates/view/index.html.twig

@@ -1,6 +1,6 @@
 {% extends 'base.html.twig' %}
 
-{% block title %}{{article.title}}{% endblock %}
+{% block title %}{{ parent() }} - {{article.title}}{% endblock %}
 
 {% block body %}
 <a href="{{ path('app_index')}}">Retour au blog</a>