-
Notifications
You must be signed in to change notification settings - Fork 21
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
Dynamic page titles #503
base: main
Are you sure you want to change the base?
Dynamic page titles #503
Conversation
👷 Deploy request for upswyng accepted. 🔨 Explore the source changes: 2bf51fe 🔍 Inspect the deploy log: https://app.netlify.com/sites/upswyng/deploys/619bc578ef736a0007887a67 |
@@ -51,6 +52,9 @@ const CategoryResults = ({ | |||
|
|||
return ( | |||
<> | |||
<Helmet> | |||
<title>{t(categoryTranslationKey)} - Upswyng</title> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thoughts on creating a utility that centralized appending the "- UpSwyng" to the title? Could create something like seo.js
in the utils folder and create a makePageTitle
that accepts a string as an argument and just returns that appended with - UpSwyng
.
import HomeButtons from "./HomeButtons"; | ||
import React from "react"; | ||
import SearchForm from "./SearchForm"; | ||
import { useTranslation } from "react-i18next"; | ||
|
||
const Home = () => { | ||
const { t } = useTranslation("footer"); | ||
const { t } = useTranslation(["footer", "home"]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another options could be removing the specific name space here and just applying it within the t function, e.g.:
const { t } = useTranslation();
// ...other stuff in between
<Helmet>
<title>{t("home.title")}</title>
<meta name="description" content={t("home.description")} />
</Helmet>
NBD either way but thought this may be a bit easier to read.
Looking good! I think we should try to add a utility that automatically appends |
ℹ️ Heads up to anyone who stumbles on this PR. I was made aware that this developer won't be able to finish this ticket and will be taking on my minor nits. I appreciate @dschwindt for getting it this far! |
This PR closes #501
What does this PR do?
When a user navigates to a different page on the site, this code dynamically updates the page titles in English and Spanish using react-helmet and react-i18next so that the titles can be reflected in analytics. The code also includes a description for the home page for SEO in both languages.
How does this PR make you feel? 🔗