Skip to content

Commit 5dce994

Browse files
committed
minor #1228 [Site] Improve SEO meta (smnandre)
This PR was squashed before being merged into the 2.x branch. Discussion ---------- [Site] Improve SEO meta Add meta description & canonical on every page Let's please Google / Pagespeed... ... to 100% and beyond 🚀 Commits ------- 36efce5 [Site] Improve SEO meta
2 parents d43627a + 36efce5 commit 5dce994

File tree

7 files changed

+42
-14
lines changed

7 files changed

+42
-14
lines changed

ux.symfony.com/templates/base.html.twig

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,23 @@
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8">
5-
<title>{% block title %}Symfony UX: JavaScript tools you'll love{% endblock %}</title>
6-
<link rel="icon" href="/favicon.ico" sizes="48x48">
7-
<link rel="icon" href="/favicon.svg" sizes="any" type="image/svg+xml">
8-
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
9-
<link rel="manifest" href="/site.webmanifest" />
10-
<link rel="mask-icon" href="https://symfony.com/favicons/safari-pinned-tab.svg" color="#5bbad5">
5+
<title>{% block title %}{{ meta.title|default }}{{ meta.title_suffix|default(' - Symfony UX') }}{% endblock %}</title>
116
<meta name="viewport" content="width=device-width, initial-scale=1">
127
<meta name="color-scheme" content="light dark">
13-
<link rel="preconnect" href="https://cdn.jsdelivr.net" />
8+
<link rel="preconnect" href="https://cdn.jsdelivr.net">
149
{% block stylesheets %}
1510
{{ ux_controller_link_tags() }}
1611
<link rel="stylesheet" href="{{ asset('styles/app.scss') }}">
1712
{% endblock %}
13+
{% if meta.canonical|default %}
14+
<link rel="canonical" href="{{ meta.canonical }}">
15+
{% endif %}
16+
<link rel="icon" href="/favicon.ico" sizes="48x48">
17+
<link rel="icon" href="/favicon.svg" sizes="any" type="image/svg+xml">
18+
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
19+
<link rel="manifest" href="/site.webmanifest">
20+
<link rel="mask-icon" href="https://symfony.com/favicons/safari-pinned-tab.svg" color="#5bbad5">
21+
<meta name="description" content="{% block description %}{{ meta.description|default }}{% endblock %}">
1822
{% block javascripts %}
1923
<script>
2024
(() => {

ux.symfony.com/templates/liveDemoBase.html.twig

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
{% extends 'base.html.twig' %}
22

3-
{% block title %}{{ demo.name }} Demo | Live Components{% endblock %}
3+
{% set meta = {
4+
title: demo.name,
5+
title_suffix: " - Symfony UX Demo",
6+
description: demo.description,
7+
canonical: url(demo.route),
8+
} %}
49

510
{% block header %}
611
<header style="">
@@ -21,7 +26,8 @@
2126
<div class="container-fluid container-xxl px-4 px-md-5 mb-5">
2227
<div class="text-center mt-md-0">
2328
<p class="eyebrows">
24-
<a href="{{ url('app_demos') }}">DEMO</a>
29+
<a href="{{ url('app_demos') }}">DEMO</a> /
30+
<a href="{{ url('app_demos') }}">LiveComponent</a>
2531
</p>
2632
<h1 class="ubuntu text-center">{{ demo.name }}</h1>
2733
<div style="font-size: 1rem; line-height: 1.75rem;" class="mt-4 demo-introduction">

ux.symfony.com/templates/main/demos.html.twig

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{% extends 'base.html.twig' %}
22

3-
{% block title %}All Symfony UX Demos{% endblock %}
3+
{% set meta = {
4+
title: "Interactive Demos",
5+
description: "Discover all that Symfony UX offers through our collection of demos, each provided with commented source code (PHP & JS)",
6+
canonical: url('app_demos'),
7+
} %}
48

59
{% block content %}
610

ux.symfony.com/templates/main/homepage.html.twig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
{% extends 'base.html.twig' %}
22

3+
{% set meta = {
4+
title: "Symfony UX: JavaScript tools you'll love",
5+
title_suffix: false,
6+
description: "A set of PHP & JavaScript packages, curated by Symfony, to solve your every day frontend problems. Featuring Stimulus and Turbo.",
7+
canonical: url('app_homepage'),
8+
} %}
9+
310
{% block content %}
411
<div class="hero hero-background">
512
<div class="container-fluid container-xxl px-4 py-4 px-md-5 py-md-5">

ux.symfony.com/templates/main/packages.html.twig

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{% extends 'base.html.twig' %}
22

3-
{% block title %}All Symfony UX Packages{% endblock %}
3+
{% set meta = {
4+
title: "All Packages",
5+
description: "Symfony UX: a treasure chest of packages to solve your frontend problems",
6+
canonical: url('app_packages'),
7+
} %}
48

59
{% block content %}
610
<div class="hero">

ux.symfony.com/templates/packageBase.html.twig

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
{% extends 'base.html.twig' %}
22

3-
{# {% set package = twigPackageHelper.currentPackage() %} #}
4-
{% block title %}{{ package.humanName }} | Symfony UX Packages{% endblock %}
3+
{% set meta = {
4+
title: package.humanName,
5+
description: package.description,
6+
canonical: url(package.route),
7+
} %}
58

69
{% block header %}
710
{{ include('_header.html.twig', {

ux.symfony.com/tests/Functional/UxPackagesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function testAllPackagesPage(): void
2525
$this->browser()
2626
->visit('/packages')
2727
->assertSuccessful()
28-
->assertSeeIn('title', 'Symfony UX Packages')
28+
->assertSeeIn('title', 'Packages')
2929
->assertSee('All Packages')
3030
;
3131
}

0 commit comments

Comments
 (0)