]> git.localhorst.tv Git - alttp.git/commitdiff
show translated event title if available
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Sun, 1 Oct 2023 13:41:28 +0000 (15:41 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Sun, 1 Oct 2023 13:41:28 +0000 (15:41 +0200)
resources/js/components/events/Detail.js
resources/js/pages/Event.js

index 3626fbd4cc4db9e390fbc9d7d64d227b167707b7..d530006b7800e48cf082a9d6c0483605e62712c3 100644 (file)
@@ -13,7 +13,10 @@ const Detail = ({ actions, event }) => {
 
        return <>
                <div className="d-flex align-items-center justify-content-between">
-                       <h1>{event.title}</h1>
+                       <h1>
+                               {(event.description && getTranslation(event.description, 'title', i18n.language))
+                                       || event.title}
+                       </h1>
                        {event.description && actions.editContent ?
                                <Button
                                        className="ms-3"
index 6e1dc46badf1e4eb55e5897baea36c7d84623672..9e5c09f66995d10ab7322cce26ddc1808ba804bd 100644 (file)
@@ -18,6 +18,7 @@ import Dialog from '../components/techniques/Dialog';
 import {
        mayEditContent,
 } from '../helpers/permissions';
+import { getTranslation } from '../helpers/Technique';
 import { useUser } from '../helpers/UserContext';
 import i18n from '../i18n';
 
@@ -125,8 +126,17 @@ const Event = () => {
 
        return <ErrorBoundary>
                <Helmet>
-                       <title>{event.title}</title>
+                       <title>
+                               {(event.description && getTranslation(event.description, 'title', i18n.language))
+                                       || event.title}
+                       </title>
                </Helmet>
+               {event.description ? <Helmet>
+                       <meta
+                               name="description"
+                               content={getTranslation(event.description, 'short', i18n.language)}
+                       />
+               </Helmet> : null}
                <CanonicalLinks base={`/events/${event.name}`} />
                <Container>
                        <Detail actions={actions} event={event} />