Skip to content

SEO & Metadata Management

TIP

Interactive Architecture Tour: Open Live Tour (SEO & OpenGraph Meta Management)

This document details canonical URL generation, search privacy boundaries (Robots directives), social share cards (OGP), and build-time static HTML localization in Scripture Habit.


1. Canonical URL Resolution

To guide search crawlers across multilingual paths (/ja/..., /en/...), SEOManager (src/components/seo-manager.tsx) dynamically resolves <link rel="canonical">:

Canonical Resolution Breakdown

  1. Path Normalization
    Extracts current browser routes and identifies whether a language prefix (/ja/, /es/) is present.

  2. Standardized URL Compilation
    Ensures uniform trailing slashes and absolute origins (https://scripturehabit.app/...).

  3. DOM Mutation
    Injects the resolved URL directly into the document <head>, consolidating indexing signals across language variations.


2. Robots Directives & Search Privacy

To protect personal reflections and private group discussions from public crawler indexing, robots meta tags are dynamically scoped per route:

Route CategoryExample PathsIndexed?Directive & Privacy Rationale
Public Core/, /privacy, /termsYesindex, follow (Public landing and compliance pages)
Dashboard/dashboard, /welcomeNonoindex, nofollow (Shields personalized study views)
Authentication/login, /signupNonoindex, nofollow (Prevents authentication caching)
Groups & Chats/group/*, /join/*Nonoindex, nofollow (Protects member chat logs)
Personal Library/my-notes, /profile, /settingsNonoindex, nofollow (Shields user notes from scrapers)

3. Social Share Previews (OGP & Twitter Cards)

When links are shared across LINE, Slack, or X (Twitter), SEOManager populates Open Graph tags (og:title, og:description, og:image) according to the active language.


4. Build-Time Static HTML Pre-Localization

For crawlers and social scrapers that do not execute client JavaScript:

  • Build Pre-Generation (scripts/localize-meta.ts): Produces static HTML files per supported language (dist/index-ja.html, dist/index-es.html, etc.) with pre-populated meta tags.
  • Edge Routing (vercel.json): Server rules route localized paths (e.g., /ja/*) to corresponding pre-rendered HTML entrypoints.

Released under the MIT License.