Skip to content

Commit 2bf51fe

Browse files
committed
add dynamic page titles including translations
1 parent 9a2f205 commit 2bf51fe

File tree

12 files changed

+77
-6
lines changed

12 files changed

+77
-6
lines changed

packages/common/src/i18n/en.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { TermsOfUseContent } from "@upswyng/common";
55
export default {
66
about: {
77
content: AboutContent.en,
8+
title: "About - Upswyng",
89
},
910
alerts: {
1011
closeAlerts: "Close Alerts",
@@ -38,6 +39,7 @@ export default {
3839
localOnly:
3940
"Favorites are only saved on this device. They will not be saved if you are using a public computer or when you have a private session enabled in your browser (incognito mode).",
4041
noFavorites: "You haven't added any favorites yet!",
42+
title: "Favorites - Upswyng",
4143
},
4244
footer: {
4345
deploysByNetlify: "deploys by Netlify",
@@ -140,6 +142,11 @@ export default {
140142
"If you, your children or someone else you know is seeking support for abuse, violence or other forms of oppression and discrimination, SPAN is here to help. From abusive relationships, domestic violence, interpersonal violence and elder abuse to oppression and discrimination based on sexual orientation, gender identity, ethnicity, race, religion, age, ability or income level, SPAN offers the support and resources needed to overcome these challenging circumstances.",
141143
},
142144
},
145+
home: {
146+
title: "Upswyng",
147+
description:
148+
"UpSwyng is a mobile-ready, digital directory of resources to assist the unhoused and at-risk communities.",
149+
},
143150
map: {
144151
directions: "Directions",
145152
directionsByBus: "Directions by bus",
@@ -158,6 +165,7 @@ export default {
158165
},
159166
privacyPolicy: {
160167
content: PrivacyPolicyContent.en,
168+
title: "Privacy Policy - Upswyng",
161169
},
162170
reportIssue: {
163171
title: "Report an Issue",
@@ -237,6 +245,7 @@ export default {
237245
},
238246
termsOfUse: {
239247
content: TermsOfUseContent.en,
248+
title: "Terms of Use - Upswyng",
240249
},
241250
mainMenu: {
242251
resourcesWithinReach: "Resources within reach",

packages/common/src/i18n/es.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { TermsOfUseContent } from "@upswyng/common";
55
export default {
66
about: {
77
content: AboutContent.es,
8+
title: "Acerca - UpSwyng",
89
},
910
alerts: {
1011
closeAlerts: "Cerrar Alertas",
@@ -38,6 +39,7 @@ export default {
3839
localOnly:
3940
"Los favoritos solo se guardan en este dispositivo. No se guardarán si está utilizando una computadora pública o cuando tiene una sesión privada habilitada en su navegador (modo incógnito).",
4041
noFavorites: "¡No has añadido ningún favorito todavía!",
42+
title: "Favoritos - UpSwyng",
4143
},
4244
footer: {
4345
deploysByNetlify: "despliegues por Netlify",
@@ -141,6 +143,11 @@ export default {
141143
"Si usted, sus hijos o alguien más que conozca está buscando apoyo para el abuso, la violencia u otras formas de opresión y discriminación, SPAN está aquí para ayudarlo. Desde las relaciones abusivas, la violencia doméstica, la violencia interpersonal y el abuso de ancianos hasta la opresión y la discriminación basadas en la orientación sexual, la identidad de género, el origen étnico, la raza, la religión, la edad, la capacidad o el nivel de ingresos, SPAN ofrece el apoyo y los recursos necesarios para superar estas circunstancias difíciles.",
142144
},
143145
},
146+
home: {
147+
title: "Upswyng",
148+
description:
149+
"UpSwyng es un directorio digital para dispositivos móviles, que continue recursos para ayudar a personas que están a punto de perder su hogar o que ya se encuentran sin hogar.",
150+
},
144151
map: {
145152
directions: "Direcciones",
146153
directionsByBus: "Direcciones via bus",
@@ -160,6 +167,7 @@ export default {
160167
},
161168
privacyPolicy: {
162169
content: PrivacyPolicyContent.es,
170+
title: "Política de Privacidad - UpSwyng",
163171
},
164172
reportIssue: {
165173
title: "Reportar un Problema",
@@ -240,6 +248,7 @@ export default {
240248
},
241249
termsOfUse: {
242250
content: TermsOfUseContent.es,
251+
title: "Condiciones De Uso - UpSwyng",
243252
},
244253
mainMenu: {
245254
resourcesWithinReach: "Recursos al Alcance",

packages/web/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"@types/react": "^16.8.10",
1818
"@types/react-dom": "^16.8.3",
1919
"@types/react-gtm-module": "^2.0.0",
20+
"@types/react-helmet": "^6.1.4",
2021
"@types/react-router-dom": "^5.1.0",
2122
"@upswyng/common": "0.1.0",
2223
"algoliasearch": "^3.33.0",
@@ -31,6 +32,7 @@
3132
"react": "16.9.0",
3233
"react-dom": "16.8.6",
3334
"react-gtm-module": "^2.0.8",
35+
"react-helmet": "^6.1.0",
3436
"react-i18next": "^11.7.3",
3537
"react-markdown": "^4.3.1",
3638
"react-query": "^1.5.1",

packages/web/public/index.html

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@
2626
work correctly both with client-side routing and a non-root public URL.
2727
Learn how to configure a non-root public URL by running `npm run build`.
2828
-->
29-
<title>UpSwyng</title>
30-
<meta
31-
name="description"
32-
content="UpSwyng is a mobile-ready, digital directory of resources to assist the unhoused and at-risk communities in Boulder County, Colorado."
33-
/>
3429
<script
3530
src="https://kit.fontawesome.com/131ea2b1bb.js"
3631
crossorigin="anonymous"

packages/web/src/components/About.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Container from "@material-ui/core/Container";
2+
import { Helmet } from "react-helmet";
23
import MuiHtml from "./MuiHtml";
34
import React from "react";
45
import { useTranslation } from "react-i18next";
@@ -8,6 +9,9 @@ const About = () => {
89

910
return (
1011
<Container>
12+
<Helmet>
13+
<title>{t("title")}</title>
14+
</Helmet>
1115
<MuiHtml html={t("content")} />
1216
</Container>
1317
);

packages/web/src/components/CategoryResults.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { TResourceCategory, TResourceSubcategory } from "../webTypes";
22

3+
import { Helmet } from "react-helmet";
34
import PageBanner from "./PageBanner";
45
import React from "react";
56
import ResourceList from "./ResourceList";
@@ -51,6 +52,9 @@ const CategoryResults = ({
5152

5253
return (
5354
<>
55+
<Helmet>
56+
<title>{t(categoryTranslationKey)} - Upswyng</title>
57+
</Helmet>
5458
<PageBanner color={categoryColor}>
5559
<Typography variant="h1">{t(categoryTranslationKey)}</Typography>
5660
</PageBanner>

packages/web/src/components/FavoriteResources.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Alert from "@material-ui/lab/Alert";
22
import Container from "@material-ui/core/Container";
3+
import { Helmet } from "react-helmet";
34
import PageBanner from "./PageBanner";
45
import React from "react";
56
import ResourceList from "./ResourceList";
@@ -34,6 +35,9 @@ export const FavoriteResources = () => {
3435

3536
return (
3637
<Container>
38+
<Helmet>
39+
<title>{t("title")}</title>
40+
</Helmet>
3741
<PageBanner color={colors.orangePrimary}>
3842
<Typography variant="h1">{t("favorites")}</Typography>
3943
</PageBanner>

packages/web/src/components/Home.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
import AlgoliaBadge from "./AlgoliaBadge";
22
import Container from "@material-ui/core/Container";
33
import { Grid } from "@material-ui/core";
4+
import { Helmet } from "react-helmet";
45
import HomeButtons from "./HomeButtons";
56
import React from "react";
67
import SearchForm from "./SearchForm";
78
import { useTranslation } from "react-i18next";
89

910
const Home = () => {
10-
const { t } = useTranslation("footer");
11+
const { t } = useTranslation(["footer", "home"]);
1112
return (
1213
<Container>
14+
<Helmet>
15+
<title>{t("title", { ns: "home" })}</title>
16+
<meta name="description" content={t("description", { ns: "home" })} />
17+
</Helmet>
1318
<Grid
1419
alignItems="stretch"
1520
container

packages/web/src/components/PrivacyPolicy.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Container from "@material-ui/core/Container";
2+
import { Helmet } from "react-helmet";
23
import MuiHtml from "./MuiHtml";
34
import React from "react";
45
import { useTranslation } from "react-i18next";
@@ -8,6 +9,9 @@ const PrivacyPolicy = () => {
89

910
return (
1011
<Container>
12+
<Helmet>
13+
<title>{t("title")}</title>
14+
</Helmet>
1115
<MuiHtml html={t("content")} />
1216
</Container>
1317
);

packages/web/src/components/Resource.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import Button from "@material-ui/core/Button/Button";
55
import Card from "@material-ui/core/Card";
66
import Container from "@material-ui/core/Container";
77
import FavoriteResourceFAB from "./FavoriteResourceFAB";
8+
import { Helmet } from "react-helmet";
89
import Image from "material-ui-image";
910
import Link from "@material-ui/core/Link";
1011
import List from "@material-ui/core/List";
@@ -97,6 +98,9 @@ export const Resource = () => {
9798

9899
return (
99100
<Container>
101+
<Helmet>
102+
<title>{resource.name} - UpSwyng</title>
103+
</Helmet>
100104
<PageBanner
101105
color={resourceColor}
102106
backButtonAction={lastLocation ? history.goBack : null}

packages/web/src/components/TermsOfUse.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Container from "@material-ui/core/Container";
2+
import { Helmet } from "react-helmet";
23
import MuiHtml from "./MuiHtml";
34
import React from "react";
45
import { useTranslation } from "react-i18next";
@@ -8,6 +9,9 @@ const TermsOfUse = () => {
89

910
return (
1011
<Container>
12+
<Helmet>
13+
<title>{t("title")}</title>
14+
</Helmet>
1115
<MuiHtml html={t("content")} />
1216
</Container>
1317
);

yarn.lock

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2325,6 +2325,13 @@
23252325
resolved "https://registry.yarnpkg.com/@types/react-gtm-module/-/react-gtm-module-2.0.0.tgz#25a118bbcadd518f376ee52626ab0829cb824874"
23262326
integrity sha512-2d7TUhOQBG6cSVSSSWaoSu+Ds84VQFTuVKLeGNc2GtfA7JDr+z3ujl4n/rezaRRNEhjn+9SllwHy1iNxxP8jDg==
23272327

2328+
"@types/react-helmet@^6.1.4":
2329+
version "6.1.4"
2330+
resolved "https://registry.yarnpkg.com/@types/react-helmet/-/react-helmet-6.1.4.tgz#3e54a3eb37ba7fb34ffafc64f425be4e68df03b9"
2331+
integrity sha512-jyx50RNZXVaTGHY3MsoRPNpeiVk8b0XTPgD/O6KHF6COTDnG/+lRjPYvTK5nfWtR3xDOux0w6bHLAsaHo2ZLTA==
2332+
dependencies:
2333+
"@types/react" "*"
2334+
23282335
"@types/react-i18next@^8.1.0":
23292336
version "8.1.0"
23302337
resolved "https://registry.yarnpkg.com/@types/react-i18next/-/react-i18next-8.1.0.tgz#5faacbfe7dc0f24729c1df6914610bfe861a50de"
@@ -13441,11 +13448,26 @@ react-error-overlay@^6.0.7:
1344113448
resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-6.0.7.tgz#1dcfb459ab671d53f660a991513cb2f0a0553108"
1344213449
integrity sha512-TAv1KJFh3RhqxNvhzxj6LeT5NWklP6rDr2a0jaTfsZ5wSZWHOGeqQyejUp3xxLfPt2UpyJEcVQB/zyPcmonNFA==
1344313450

13451+
react-fast-compare@^3.1.1:
13452+
version "3.2.0"
13453+
resolved "https://registry.yarnpkg.com/react-fast-compare/-/react-fast-compare-3.2.0.tgz#641a9da81b6a6320f270e89724fb45a0b39e43bb"
13454+
integrity sha512-rtGImPZ0YyLrscKI9xTpV8psd6I8VAtjKCzQDlzyDvqJA8XOW78TXYQwNRNd8g8JZnDu8q9Fu/1v4HPAVwVdHA==
13455+
1344413456
react-gtm-module@^2.0.8:
1344513457
version "2.0.8"
1344613458
resolved "https://registry.yarnpkg.com/react-gtm-module/-/react-gtm-module-2.0.8.tgz#0d37c4f2a4e3a8efa40c76c8b2aa1b7cacc16c6f"
1344713459
integrity sha512-OU5FwAHC3gWnnxJ+MLwBMLZO1Pmn1DiVCGHqptwDnNojE3QRrNxjqozkW5cNS4Zp+C6HZ8a4ZIt0QPNlpzua4Q==
1344813460

13461+
react-helmet@^6.1.0:
13462+
version "6.1.0"
13463+
resolved "https://registry.yarnpkg.com/react-helmet/-/react-helmet-6.1.0.tgz#a750d5165cb13cf213e44747502652e794468726"
13464+
integrity sha512-4uMzEY9nlDlgxr61NL3XbKRy1hEkXmKNXhjbAIOVw5vcFrsdYbH2FEwcNyWvWinl103nXgzYNlns9ca+8kFiWw==
13465+
dependencies:
13466+
object-assign "^4.1.1"
13467+
prop-types "^15.7.2"
13468+
react-fast-compare "^3.1.1"
13469+
react-side-effect "^2.1.0"
13470+
1344913471
react-i18next@*, react-i18next@^11.7.3:
1345013472
version "11.7.3"
1345113473
resolved "https://registry.yarnpkg.com/react-i18next/-/react-i18next-11.7.3.tgz#256461c46baf5b3208c3c6860ca4e569fc7ed053"
@@ -13719,6 +13741,11 @@ react-scripts@^3.3.0:
1371913741
optionalDependencies:
1372013742
fsevents "2.1.2"
1372113743

13744+
react-side-effect@^2.1.0:
13745+
version "2.1.1"
13746+
resolved "https://registry.yarnpkg.com/react-side-effect/-/react-side-effect-2.1.1.tgz#66c5701c3e7560ab4822a4ee2742dee215d72eb3"
13747+
integrity sha512-2FoTQzRNTncBVtnzxFOk2mCpcfxQpenBMbk5kSVBg5UcPqV9fRbgY2zhb7GTWWOlpFmAxhClBDlIq8Rsubz1yQ==
13748+
1372213749
react-test-renderer@16.9.0:
1372313750
version "16.9.0"
1372413751
resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-16.9.0.tgz#7ed657a374af47af88f66f33a3ef99c9610c8ae9"

0 commit comments

Comments
 (0)