Skip to content

Commit 7a8f6b4

Browse files
committed
feature #1907 [Site] Social metadata (smnandre)
This PR was squashed before being merged into the 2.x branch. Discussion ---------- [Site] Social metadata Add FB/Twitter metadata, link the twitter acount and update demo images. Social images for ackages will be done later -- TODO After - [x] bigger social demo images (1200x675) -> will oversize them via Pixelmator - [ ] one social image per package (on it) Commits ------- 2a369c6 [Site] Social metadata
2 parents 18a18d1 + 2a369c6 commit 7a8f6b4

31 files changed

+124
-27
lines changed
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 17 additions & 0 deletions
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
349 Bytes
Loading
Loading
12 Bytes
Loading

ux.symfony.com/assets/styles/sections/_nav.scss

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
flex-wrap: nowrap;
2525
display: flex;
2626
flex-direction: row-reverse;
27-
gap: 1.5rem;
27+
gap: 1rem;
2828
align-items: center;
2929

3030
@media (min-width: 860px) {
@@ -83,18 +83,22 @@
8383
font-weight: 500;
8484
letter-spacing: 0;
8585
opacity: .9;
86-
transition: opacity 250ms;
8786
padding: 0;
8887
border: none;
8988
background: none;
9089
text-align: center;
9190
line-height: 2rem;
9291
position: relative;
92+
transition: all 250ms;
9393
&:hover {
9494
opacity: 1;
9595
}
9696
}
9797

98+
.AppNav_actions .AppNav_item:hover {
99+
transform: scale(1.1);
100+
}
101+
98102
.AppNav_item--icon {
99103
padding: 0;
100104
width: 1.5rem;

ux.symfony.com/composer.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ux.symfony.com/src/Model/LiveDemo.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ public function getTags(): array
5656
return $this->tags;
5757
}
5858

59-
public function getScreenshotFilename(): string
59+
public function getScreenshotFilename(?string $format = null): string
6060
{
61-
return 'images/live_demo/'.$this->identifier.'.png';
61+
return 'images/live_demo/'.$this->identifier.($format ? ('-'.$format) : '').'.png';
6262
}
6363
}

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

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,34 @@
33

44
<nav class="AppNav AppNav--white">
55

6-
<a class="AppHeader_logo" href="{{ path('app_homepage') }}" aria-label="Homepage">
6+
<a class="AppHeader_logo" href="{{ path('app_homepage') }}" aria-label="Symfony UX">
77
<img src="{{ asset('images/sf-ux.svg') }}" alt="Symfony UX" width="161" height="30" />
88
</a>
99

1010
<div class="AppNav_actions">
1111
<button
1212
class="AppHeader_toggler AppNav_item AppNav_item--icon"
13-
aria-label="Toggle Menu"
1413
data-action="ux-header#toggleMenu"
14+
aria-label="Toggle menu"
1515
>
1616
<twig:Icon name="menu"/>
1717
</button>
18-
1918
<twig:ThemeSwitcher class="AppNav_item AppNav_item--icon" aria-label="Switch dark/light mode"/>
2019
<a
2120
class="AppNav_item AppNav_item--icon"
22-
aria-label="Symfony UX on GitHub"
21+
href="https://x.com/symfonyux"
22+
rel="external me"
23+
title="Symfony UX on X (Twitter)"
24+
>
25+
<twig:Icon name="x-twitter"/>
26+
</a>
27+
<a
28+
class="AppNav_item AppNav_item--icon"
2329
href="https://github.com/symfony/ux"
30+
rel="external me"
31+
title="Symfony UX on GitHub"
2432
>
25-
<twig:Icon name="github"/>
33+
<twig:Icon name="github" />
2634
</a>
2735
</div>
2836

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
2+
{% if meta.canonical|default %}
3+
<link rel="canonical" href="{{ meta.canonical }}">
4+
{% endif %}
5+
6+
<meta name="description" content="{% block description %}{{ meta.description|default|u.truncate(200, '...') }}{% endblock %}">
7+
8+
{% set og_title = meta.og.title ?? meta.title ?? null %}
9+
{% if og_title %}
10+
<meta property="og:title" content="{{ og_title|u.truncate(55, '...') }}">
11+
{% endif %}
12+
{% set og_description = meta.og.description ?? meta.description ?? null %}
13+
{% if og_description %}
14+
<meta property="og:description" content="{{ og_description|u.truncate(160, '...') }}">
15+
{% endif %}
16+
{% set og_url = meta.og.url ?? meta.canonical ?? null %}
17+
{% if og_url %}
18+
<meta property="og:url" content="{{ absolute_url(og_url) }}">
19+
{% endif %}
20+
{% set image = meta.og.image ?? meta.image ?? null %}
21+
{% if image.url|default %}
22+
<meta property="og:image" content="{{ absolute_url(image.url) }}">
23+
<meta property="og:image:width" content="{{ image.width }}">
24+
<meta property="og:image:height" content="{{ image.height }}">
25+
<meta property="og:image:type" content="{{ image.type|default('image/png') }}">
26+
{% if image.alt|default %}
27+
<meta property="og:image:alt" content="{{ image.alt }}">
28+
{% endif %}
29+
{% else %}
30+
<meta property="og:image" content="{{ absolute_url(asset('images/symfony-ux.png')) }}">
31+
<meta property="og:image:width" content="1024">
32+
<meta property="og:image:height" content="576">
33+
<meta property="og:image:type" content="image/png">
34+
<meta property="og:image:alt" content="Symfony UX">
35+
{% endif %}
36+
<meta property="og:site_name" content="Symfony UX" />
37+
38+
{% if meta.tiwtter.title|default %}
39+
<meta name="twitter:title" content="{{ meta.twitter.title|u.truncate(55, '...') }}">
40+
{% endif %}
41+
{% if meta.twitter.description|default %}
42+
<meta name="twitter:description" content="{{ meta.twitter.description|u.truncate(160, '...') }}">
43+
{% endif %}
44+
{% set image = meta.twitter.image ?? meta.og.image ?? meta.image ?? null %}
45+
{% if image.url|default %}
46+
<meta name="twitter:image" content="{{ absolute_url(image.url) }}">
47+
<meta name=”twitter:cardcontent=”summary_large_image” />
48+
{% endif %}
49+
<meta name="twitter:site" content="@SymfonyUX">

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

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,20 @@
55
<title>{% block title %}{{ meta.title|default }}{{ meta.title_suffix|default(' - Symfony UX') }}{% endblock %}</title>
66
<meta name="viewport" content="width=device-width, initial-scale=1">
77
<meta name="color-scheme" content="dark light">
8-
{% block stylesheets %}
9-
{% endblock %}
10-
{% if meta.canonical|default %}
11-
<link rel="canonical" href="{{ meta.canonical }}">
12-
{% endif %}
138
<meta name="view-transition" content="same-origin" />
149
<link rel="icon" href="/favicon.ico" sizes="48x48">
1510
<link rel="icon" href="/favicon.svg" sizes="any" type="image/svg+xml">
1611
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
1712
<link rel="manifest" href="/site.webmanifest">
1813
<link rel="mask-icon" href="https://symfony.com/favicons/safari-pinned-tab.svg" color="#5bbad5">
19-
<meta name="description" content="{% block description %}{{ meta.description|default }}{% endblock %}">
20-
<meta property="og:site_name" content="Symfony UX" />
21-
<meta property="og:image" content="{{ absolute_url(asset('images/symfony-ux.png')) }}">
22-
<meta property="og:image:width" content="1024">
23-
<meta property="og:image:height" content="576">
24-
<meta property="og:image:alt" content="Symfony UX">
25-
<meta property="og:image:type" content="image/png">
14+
15+
{% block stylesheets %}
16+
{% endblock %}
17+
18+
{% block meta %}
19+
{{ include('_meta.html.twig', {meta: meta|default}) }}
20+
{% endblock %}
21+
2622
{% block javascripts %}
2723
<script>
2824
const theme = localStorage.getItem('user-theme') || (window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark');
@@ -42,6 +38,7 @@
4238
{% endblock %}
4339
</head>
4440
<body>
41+
4542
{% block banner %}
4643
{{ include('_banner.html.twig') }}
4744
{% endblock %}

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,19 @@
44
title: demo.name,
55
title_suffix: ' - Symfony UX Demo',
66
description: demo.description,
7+
og: {
8+
title: demo.name ~ ' - Symfony UX Demo',
9+
description: demo.longDescription|striptags|u.truncate(200, '...')
10+
},
11+
image: {
12+
url: absolute_url(asset(demo.screenshotFilename('1280x720'))),
13+
width: 1280,
14+
height: 720,
15+
},
716
canonical: url(demo.route),
17+
twitter: {
18+
card: 'summary_large_image',
19+
}
820
} %}
921

1022
{% block content %}

ux.symfony.com/templates/demos/live_memory/index.html.twig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@
55
title_suffix: ' - Symfony UX Demo',
66
description: demo.description,
77
canonical: url(demo.route),
8+
image: {
9+
url: absolute_url(asset(demo.screenshotFilename('1280x720'))),
10+
width: 1080,
11+
height: 720,
12+
},
13+
og: {
14+
title: demo.name ~ ' - Symfony UX Demo',
15+
description: demo.longDescription|striptags|u.truncate(200, '...')
16+
}
817
} %}
918

1019
{% block stylesheets %}

0 commit comments

Comments
 (0)