Skip to content

[Site] Social metadata #1907

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ux.symfony.com/assets/icons/hugeicons/new-twitter.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions ux.symfony.com/assets/images/icons/x-twitter.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ux.symfony.com/assets/images/live_demo/dependent-form-fields.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ux.symfony.com/assets/images/live_demo/form-collection-type.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ux.symfony.com/assets/images/live_demo/infinite-scroll-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ux.symfony.com/assets/images/live_demo/infinite-scroll.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ux.symfony.com/assets/images/live_demo/inline-edit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ux.symfony.com/assets/images/live_demo/invoice.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ux.symfony.com/assets/images/live_demo/live-memory.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ux.symfony.com/assets/images/live_demo/upload.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ux.symfony.com/assets/images/live_demo/voting.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions ux.symfony.com/assets/styles/sections/_nav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
flex-wrap: nowrap;
display: flex;
flex-direction: row-reverse;
gap: 1.5rem;
gap: 1rem;
align-items: center;

@media (min-width: 860px) {
Expand Down Expand Up @@ -83,18 +83,22 @@
font-weight: 500;
letter-spacing: 0;
opacity: .9;
transition: opacity 250ms;
padding: 0;
border: none;
background: none;
text-align: center;
line-height: 2rem;
position: relative;
transition: all 250ms;
&:hover {
opacity: 1;
}
}

.AppNav_actions .AppNav_item:hover {
transform: scale(1.1);
}

.AppNav_item--icon {
padding: 0;
width: 1.5rem;
Expand Down
12 changes: 6 additions & 6 deletions ux.symfony.com/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions ux.symfony.com/src/Model/LiveDemo.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ public function getTags(): array
return $this->tags;
}

public function getScreenshotFilename(): string
public function getScreenshotFilename(?string $format = null): string
{
return 'images/live_demo/'.$this->identifier.'.png';
return 'images/live_demo/'.$this->identifier.($format ? ('-'.$format) : '').'.png';
}
}
18 changes: 13 additions & 5 deletions ux.symfony.com/templates/_header.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,34 @@

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

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

<div class="AppNav_actions">
<button
class="AppHeader_toggler AppNav_item AppNav_item--icon"
aria-label="Toggle Menu"
data-action="ux-header#toggleMenu"
aria-label="Toggle menu"
>
<twig:Icon name="menu"/>
</button>

<twig:ThemeSwitcher class="AppNav_item AppNav_item--icon" aria-label="Switch dark/light mode"/>
<a
class="AppNav_item AppNav_item--icon"
aria-label="Symfony UX on GitHub"
href="https://x.com/symfonyux"
rel="external me"
title="Symfony UX on X (Twitter)"
>
<twig:Icon name="x-twitter"/>
</a>
<a
class="AppNav_item AppNav_item--icon"
href="https://github.com/symfony/ux"
rel="external me"
title="Symfony UX on GitHub"
>
<twig:Icon name="github"/>
<twig:Icon name="github" />
</a>
</div>

Expand Down
49 changes: 49 additions & 0 deletions ux.symfony.com/templates/_meta.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@

{% if meta.canonical|default %}
<link rel="canonical" href="{{ meta.canonical }}">
{% endif %}

<meta name="description" content="{% block description %}{{ meta.description|default|u.truncate(200, '...') }}{% endblock %}">

{% set og_title = meta.og.title ?? meta.title ?? null %}
{% if og_title %}
<meta property="og:title" content="{{ og_title|u.truncate(55, '...') }}">
{% endif %}
{% set og_description = meta.og.description ?? meta.description ?? null %}
{% if og_description %}
<meta property="og:description" content="{{ og_description|u.truncate(160, '...') }}">
{% endif %}
{% set og_url = meta.og.url ?? meta.canonical ?? null %}
{% if og_url %}
<meta property="og:url" content="{{ absolute_url(og_url) }}">
{% endif %}
{% set image = meta.og.image ?? meta.image ?? null %}
{% if image.url|default %}
<meta property="og:image" content="{{ absolute_url(image.url) }}">
<meta property="og:image:width" content="{{ image.width }}">
<meta property="og:image:height" content="{{ image.height }}">
<meta property="og:image:type" content="{{ image.type|default('image/png') }}">
{% if image.alt|default %}
<meta property="og:image:alt" content="{{ image.alt }}">
{% endif %}
{% else %}
<meta property="og:image" content="{{ absolute_url(asset('images/symfony-ux.png')) }}">
<meta property="og:image:width" content="1024">
<meta property="og:image:height" content="576">
<meta property="og:image:type" content="image/png">
<meta property="og:image:alt" content="Symfony UX">
{% endif %}
<meta property="og:site_name" content="Symfony UX" />

{% if meta.tiwtter.title|default %}
<meta name="twitter:title" content="{{ meta.twitter.title|u.truncate(55, '...') }}">
{% endif %}
{% if meta.twitter.description|default %}
<meta name="twitter:description" content="{{ meta.twitter.description|u.truncate(160, '...') }}">
{% endif %}
{% set image = meta.twitter.image ?? meta.og.image ?? meta.image ?? null %}
{% if image.url|default %}
<meta name="twitter:image" content="{{ absolute_url(image.url) }}">
<meta name=”twitter:card” content=”summary_large_image” />
{% endif %}
<meta name="twitter:site" content="@SymfonyUX">
21 changes: 9 additions & 12 deletions ux.symfony.com/templates/base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,20 @@
<title>{% block title %}{{ meta.title|default }}{{ meta.title_suffix|default(' - Symfony UX') }}{% endblock %}</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="dark light">
{% block stylesheets %}
{% endblock %}
{% if meta.canonical|default %}
<link rel="canonical" href="{{ meta.canonical }}">
{% endif %}
<meta name="view-transition" content="same-origin" />
<link rel="icon" href="/favicon.ico" sizes="48x48">
<link rel="icon" href="/favicon.svg" sizes="any" type="image/svg+xml">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<link rel="manifest" href="/site.webmanifest">
<link rel="mask-icon" href="https://symfony.com/favicons/safari-pinned-tab.svg" color="#5bbad5">
<meta name="description" content="{% block description %}{{ meta.description|default }}{% endblock %}">
<meta property="og:site_name" content="Symfony UX" />
<meta property="og:image" content="{{ absolute_url(asset('images/symfony-ux.png')) }}">
<meta property="og:image:width" content="1024">
<meta property="og:image:height" content="576">
<meta property="og:image:alt" content="Symfony UX">
<meta property="og:image:type" content="image/png">

{% block stylesheets %}
{% endblock %}

{% block meta %}
{{ include('_meta.html.twig', {meta: meta|default}) }}
{% endblock %}

{% block javascripts %}
<script>
const theme = localStorage.getItem('user-theme') || (window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark');
Expand All @@ -42,6 +38,7 @@
{% endblock %}
</head>
<body>

{% block banner %}
{{ include('_banner.html.twig') }}
{% endblock %}
Expand Down
12 changes: 12 additions & 0 deletions ux.symfony.com/templates/demos/live_demo.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,19 @@
title: demo.name,
title_suffix: ' - Symfony UX Demo',
description: demo.description,
og: {
title: demo.name ~ ' - Symfony UX Demo',
description: demo.longDescription|striptags|u.truncate(200, '...')
},
image: {
url: absolute_url(asset(demo.screenshotFilename('1280x720'))),
width: 1280,
height: 720,
},
canonical: url(demo.route),
twitter: {
card: 'summary_large_image',
}
} %}

{% block content %}
Expand Down
9 changes: 9 additions & 0 deletions ux.symfony.com/templates/demos/live_memory/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
title_suffix: ' - Symfony UX Demo',
description: demo.description,
canonical: url(demo.route),
image: {
url: absolute_url(asset(demo.screenshotFilename('1280x720'))),
width: 1080,
height: 720,
},
og: {
title: demo.name ~ ' - Symfony UX Demo',
description: demo.longDescription|striptags|u.truncate(200, '...')
}
} %}

{% block stylesheets %}
Expand Down