From 699e01c396e5fd79b4971e86becec0d97c9778bb Mon Sep 17 00:00:00 2001 From: ghost Date: Sat, 6 Jan 2024 23:56:42 +0200 Subject: [PATCH] add meta tags config --- .env | 5 +++++ config/packages/twig.yaml | 4 ++++ config/services.yaml | 3 +++ templates/default/layout.html.twig | 4 +++- 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.env b/.env index 17c3080..b47340a 100644 --- a/.env +++ b/.env @@ -48,6 +48,11 @@ APP_VERSION="1.0.0" # Application name APP_NAME="HLState" +# SEO +APP_META_TITLE="HLState" +APP_META_DESCRIPTION="HLState - Open Source Web Stats for Half-Life Server" +APP_META_KEYWORDS="Half-Life, HLState, YGGverse, Servers, Stats, Online, Analytics, Explorer" + # Application template APP_THEME="default" diff --git a/config/packages/twig.yaml b/config/packages/twig.yaml index 2993b79..0eaa287 100644 --- a/config/packages/twig.yaml +++ b/config/packages/twig.yaml @@ -5,6 +5,10 @@ twig: version: '%app.version%' name: '%app.name%' theme: '%app.theme%' + meta: + title: '%env(APP_META_TITLE)%' + description: '%env(APP_META_DESCRIPTION)%' + keywords: '%env(APP_META_KEYWORDS)%' when@test: twig: strict_variables: true diff --git a/config/services.yaml b/config/services.yaml index f180fff..ee66304 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -8,6 +8,9 @@ parameters: app.name: '%env(APP_NAME)%' app.theme: '%env(APP_THEME)%' app.hlservers: '%env(APP_HLSERVERS)%' + app.meta.title: '%env(APP_META_TITLE)%' + app.meta.description: '%env(APP_META_DESCRIPTION)%' + app.meta.keywords: '%env(APP_META_KEYWORDS)%' services: # default configuration for services in *this* file diff --git a/templates/default/layout.html.twig b/templates/default/layout.html.twig index 4ce10df..018f0e9 100644 --- a/templates/default/layout.html.twig +++ b/templates/default/layout.html.twig @@ -2,7 +2,9 @@ - {% block head_title_content %}{{ app.name }}{% endblock %} + + + {% block head_title_content %}{{ app.meta.title }}{% endblock %}