Skip to content

codex texts update#3

Merged
devcodex2025 merged 1 commit intonextfrom
seo-full-fix-2026
Apr 16, 2026
Merged

codex texts update#3
devcodex2025 merged 1 commit intonextfrom
seo-full-fix-2026

Conversation

@devcodex2025
Copy link
Copy Markdown
Owner

No description provided.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
generatepasswordto.me Ready Ready Preview, Comment Apr 16, 2026 3:09am

@devcodex2025 devcodex2025 merged commit dfe0664 into next Apr 16, 2026
2 checks passed
@devcodex2025 devcodex2025 deleted the seo-full-fix-2026 branch April 16, 2026 03:26
devcodex2025 added a commit that referenced this pull request Apr 16, 2026
This reverts commit dfe0664, reversing
changes made to 3678df7.
@devin-ai-integration
Copy link
Copy Markdown
Contributor

Thorough Code Review — PR #3 + Recent Commits

I reviewed this PR alongside the 5 most recent commits (464cec5, 3678df7, 21e3de7, 468a610, f4ff96a). Below is a consolidated review covering bugs, edge cases, and improvement suggestions.


🐛 Bugs

1. Critical: Double-locale in canonical/alternate URLs (src/lib/seo.ts)

buildGuideCollectionMetadata and buildStaticPageMetadata both prepend the locale to the pathname before passing it to buildLocalizedMetadata, which also prepends the locale via getLocaleBaseUrl(). This produces broken URLs like:

https://www.generatepasswordto.me/ua/ua/guides
https://www.generatepasswordto.me/fr/ua/guides  (in alternates)

Fix: These functions should pass just guides or slug — not ${normalizeLocale(locale)}/guides:

// seo.ts line 164
pathname: `${normalizeLocale(locale)}/guides`,   // ❌ BUG
pathname: `guides`,                                // ✅ FIX

Same issue in buildStaticPageMetadata (line 173).

The guide article page ([slug]/page.tsx lines 59, 138) has the same problem — it passes ${normalizedLocale}/guides/${slug} to buildLocaleAlternates, producing hreflang URLs like https://www.generatepasswordto.me/fr/en/guides/slug.

2. openGraph.locale removed without replacement ([locale]/layout.tsx)

The PR removed locale: ogLocaleMap[locale] || 'en_US' from the openGraph metadata but OG_LOCALE_MAP is still exported and used in buildLocalizedMetadata in seo.ts. The root layout's own generateMetadata no longer sets the OG locale, so pages using the layout metadata directly will lack this signal. This is inconsistent — either use it everywhere or remove it.

3. HtmlLangSync is client-only — SSR HTML lacks correct lang attribute

HtmlLangSync uses useEffect to set document.documentElement.lang on the client. During SSR (and for search engine crawlers that don't execute JS), the <html> tag won't have the correct lang value. For SEO and accessibility, the lang attribute should be set server-side in the root <html> element of the layout, not via a client-side effect.

4. buildHomeSchemas HowTo schema has hardcoded English text

name: 'How to generate a secure password',
description: 'Use the generator, review the strength indicator, and copy...',

These are hardcoded in English regardless of the locale parameter. For non-English pages, the inLanguage field says one thing while the content says another, which confuses structured data validators and search engines.

5. resolveGuideInterlinkHref always uses /${locale}/ — wrong for English

case 'home':
  return `/${locale}/`;

For English (locale === 'en'), this generates /en/ instead of /. While you may have a redirect in place, this creates unnecessary redirect chains and inconsistent internal linking. Should use getLocaleHomePath from site-config.ts.

6. Invalid CSS class rounded-24 in guide pages

In [slug]/page.tsx line 92 and others, the class rounded-24 is used. This is not a standard Tailwind class. It should be rounded-[24px] (arbitrary value syntax) unless you have a custom Tailwind config extending this — and I don't see one.


⚠️ Edge Cases

7. buildMetaDescription truncation can break mid-word or cut off meaning

The truncation logic (f4ff96a) slices to 155 chars and finds the last space. But if there is no space in the first 155 characters (e.g., a long CJK string without spaces for zh/ja locales), boundary will be 0 and it falls through to the raw truncated string — which may break mid-character for multi-byte content. Consider adding when truncating so users/bots know the text is cut off.

8. normalizeLocale silently falls back to 'en'

If an invalid locale is passed (typo, attack, etc.), it silently returns 'en'. This can mask routing bugs. Consider logging a warning in development mode.

9. JsonLd component doesn't escape HTML in JSON

dangerouslySetInnerHTML={{ __html: JSON.stringify(data) }} — if any article content contains </script>, JSON.stringify won't escape it, potentially breaking the page. Consider using a safe serializer that escapes </ sequences.


🔧 Improvements

10. Duplicated locale/translation constants across files

There are now 4 separate places maintaining the same locale list and translations:

  • SUPPORTED_LOCALES in site-config.ts
  • SUPPORTED_CONTENT_LANGUAGES in articles.ts
  • LocaleKey type in HomePageSections.tsx
  • footerLabels in Footer.jsx (duplicates linkTranslations.ts)

The Footer specifically removed its import of getLinkLabel from linkTranslations.ts and recreated the same data inline. This guarantees translation drift over time. Consolidate to a single source of truth.

11. buildLocaleAlternates pathname contract is ambiguous

The function accepts a pathname parameter, but callers inconsistently pass locale-prefixed vs locale-free paths. The function's intent is to generate alternates for all locales, so it should document and enforce that pathname must be locale-free (e.g., guides/slug, not en/guides/slug).

12. Redirect fix/revert cycle (commits 334779c41e0546)

The original redirect commit (334779c) replaced permanentRedirect with a client-side LocaleRedirect component. This was immediately reverted. The reverted code still has an indentation issue:

    const defaultLanguage = (typeof mappedLanguage === 'string' && supportedLanguages.includes(mappedLanguage))
    ? mappedLanguage
    : 'en';

The ternary operator is indented at the wrong level. This was fixed in PR #3's version of page.tsx.

13. getLocalizedInterlinkAnchor fallback chain

The interlinking anchors file (interlinking-anchors.ts) falls back to English if a locale translation is missing. But for CJK locales (zh, ja), the anchor text appears to be truncated/garbled in several entries (e.g., '密生器' for zh home-generator). These should be verified by native speakers.

14. Large article content blob in a single file

articles.ts is ~2000 lines and growing. Consider splitting per-language or per-article into separate files and lazy-loading them. This will improve build times and code maintainability.


Summary

The refactoring direction is solid — centralizing SEO config into site-config.ts and seo.ts is a good architectural move. But the double-locale URL bug (issue #1) is a critical SEO problem that would produce broken canonical/alternate URLs across the entire site. The HtmlLangSync SSR gap (issue #3) and hardcoded English in structured data (issue #4) are also significant for an SEO-focused app. I'd prioritize fixing those before the next deploy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant