Repository navigation
feat(seo): add localized metadata and hreflang for es/pt routes (#164) - #169
truthixify merged 16 commits into
Conversation
…th-protocol#164) - Add pageSeo keys to en/es/pt translation files for home, stellar, grants, blog, and case-studies (title + description per locale) - Add src/utils/seo.ts with usePageSeo hook, canonicalUrl helper, and hreflangAlternates generator (en, es, pt-BR, x-default) - Wire usePageSeo into App (Home), Stellar, Grants, Blog, CaseStudies pages — Helmet now emits locale-aware title, description, canonical link, og:title/description, twitter:title/description, and hreflang alternate links on every covered route - Update scripts/og.ts patchMetadata to inject canonical + hreflang link tags into static HTML files at build time - Add src/__tests__/seo.test.tsx covering canonicalUrl, hreflang alternates, and page-level title/description for all five pages across en, es, and pt locales
|
@cybermax4200 is attempting to deploy a commit to the truthixify's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@cybermax4200 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
- Rename hreflang -> hrefLang on HreflangAlternate interface and all usages (React JSX prop is hrefLang, not hreflang) - Remove duplicate usePageSeo import in Blog.tsx
|
All en, es, pt-BR, and x-default hreflang entries point to the same URL. Search engines need distinct crawlable locale URLs. Please map each language to its real localized route and test those URLs. |
1 similar comment
|
All en, es, pt-BR, and x-default hreflang entries point to the same URL. Search engines need distinct crawlable locale URLs. Please map each language to its real localized route and test those URLs. |
All four hreflang alternates (en, es, pt-BR, x-default) previously pointed to the same canonical URL, making them useless for search engines. Changes: - src/utils/seo.ts: add LOCALE_URL_PREFIX map and localizedUrl() so es -> /es/*, pt-BR -> /pt/*, en/x-default -> canonical - src/App.tsx: add LocaleScope component + /es/* and /pt/* route variants for home, stellar, grants, blog, case-studies - src/pages/Stellar.tsx: add missing usePageSeo import - scripts/og.ts: fix undeclared canonicalUrl/siteUrl variables in patchMetadata; derive en/es/pt URLs from config.routePath - scripts/gen-sitemap.mjs: include the 10 locale-prefixed routes in sitemap.xml - src/__tests__/seo.test.tsx: update assertions to expect distinct per-locale URLs; add 4 new passing utility tests
Done. Please review |
|
The hreflang URLs are distinct now, but navigation leaves them immediately. Header, blog, and case-study links still point to unprefixed routes, and English routes do not reset the locale. Keep locale prefixes during navigation or synchronize the URL and language centrally, then add route-navigation tests. |
…ish routes - Add useLocalePath hook that prefixes internal paths with /es or /pt based on the active i18n locale, leaving English paths unprefixed - Add LocaleSync component (mounted in BrowserRouter) that resets the locale to English whenever the URL has no /es or /pt prefix, so navigating back to an English route always syncs the language state - Update Header: convert all bare <a href> internal links to <Link to> and apply lp() to /press, /use-cases, /grants, /stellar, /roadmap, /blog in both desktop nav and mobile menu - Update CaseStudiesStrip: apply lp() to the view-all and card links - Update Footer: apply lp() to all column links and newsletter widget - Add src/__tests__/routing.test.tsx (16 tests) covering: useLocalePath prefix logic, Header link prefixes per locale, LocaleSync reset on unprefixed routes, no-reset on prefixed routes
Done, Please review. |
|
Header links are fixed, but Blog and CaseStudies still use unprefixed links, so localized navigation resets to English. Footer now prefixes routes that do not exist, such as |
- Add hasLocalizedRoute() and useLocalizedPath() hook - Update Footer to only prefix routes with localized versions - Add CaseStudies link to Footer with i18n keys - Add comprehensive routing tests for prefixed/non-prefixed cases Fixes 404s for /es/privacy, /pt/about by only prefixing routes with /es/* and /pt/* equivalents (/, /stellar, /grants, /blog, /case-studies)
Please Review |
|
The footer fix is good, but Blog and Case Studies still use unprefixed internal links. Please route their list, detail, back, author, and tag links through the locale helper, and add coverage for author and tag paths. |
- Update hasLocalizedRoute for blog/author, blog/tag, blog/:slug, case-studies/:slug - Use useLocalizedPath in Blog.tsx and CaseStudies.tsx - Add tests for author/tag paths
Done, Please review |
|
The content links are fixed, but localized author and tag URLs still have no matching routes in App.tsx, so paths like /es/blog/author/name will 404. Also, usePageSeo still gives every localized page the English canonical URL. Add the missing routes and make canonicals locale-aware, with route-level tests. |
- Add /es/blog/author, /es/blog/tag, /pt/blog/author, /pt/blog/tag routes in App.tsx - Fix usePageSeo to return locale-specific canonical URL (not always English) - Add pageSeo translations for home, stellar, grants, blog, caseStudies (en/es/pt) - Add route-level tests for localized blog author/tag and case studies detail pages - Add localizedDynamicUrl helper for dynamic page URLs
Please Review |
|
The missing routes and list-page canonicals are fixed. Dynamic localized routes still have no canonical or hreflang tags: blog posts, authors, tags, and case-study details use separate metadata, while localizedDynamicUrl is unused. Add localized SEO there or keep those routes unprefixed. |
…, tags, case studies) - Add localizedDynamicUrl and hreflangAlternatesDynamic helpers - Update BlogPostDetail, BlogAuthor, TagArchive with locale-aware canonical/hreflang - Update CaseStudyDetail with locale-aware canonical/hreflang - Update SEO tests to use locale-prefixed routes - All 52 routing + blog tests pass, build succeeds
Done |
truthixify
left a comment
There was a problem hiding this comment.
Localized routes now keep their locale and emit matching canonical and hreflang metadata. Required CI passes. Looks good.
|
Merged. Localized routes now have consistent navigation, canonicals, and hreflang metadata. Thanks @cybermax4200. |
@truthixify Thank you so much for the opportunity to contribution in your project |
Closes #164
Summary
Wave 9 localized SEO metadata for Spanish and Portuguese routes.
New file:
src/utils/seo.tsusePageSeo(page)hook — returns locale-aware title, description,canonical, and alternates for the active i18n language
canonicalUrl(page)— always returns the English base URL (canonicalis language-neutral, matching the site's localStorage locale
strategy)
hreflangAlternates(page)— emitsen,es,pt-BR, andx-defaultentries all pointing at the canonical URLi18n files
Added
pageSeonamespace toen.json,es.json,pt.jsonwithlocalized title + description for: home, stellar, grants, blog,
caseStudies.
Pages updated
App.tsx(Home)<Helmet>withusePageSeo('home')Stellar.tsxusePageSeo('stellar')Grants.tsx<Helmet>(previously had none) viausePageSeo('grants')Blog.tsxBlogListwithusePageSeo('blog')CaseStudies.tsx<Helmet>toCaseStudiesListviausePageSeo('caseStudies')Every Helmet now emits: locale-aware
<title>,<meta name="description">,<link rel="canonical">, hreflang alternates ×4,og:title/description/url,twitter:title/description.scripts/og.tspatchMetadata()injects canonical + hreflang<link>tags into eachstatic HTML file at build time so crawlers see them before hydration.
Tests
src/__tests__/seo.test.tsx: unit tests forcanonicalUrlandhreflangAlternates, plus integration tests verifying locale-correctdocument.titlefor all 5 pages × 3 locales, and DOM assertions forhreflang link tags.
Done when checklist