* Fix SEO indexing: add hreflang, canonicals, sitemap per-locale entries Google Search Console showed 380 not-indexed vs 86 indexed pages. Root causes: missing hreflang tags on rendered pages (only in sitemap), no canonical on homepage, inconsistent canonicals wiping parent hreflang, sitemap only listing English URLs, trailing slash duplicates, and _next/static chunks being crawled as pages. Changes: - Add buildAlternates() utility for consistent canonical + hreflang - Add hreflang tags to all pages via alternates.languages in metadata - Add self-referencing canonical URLs to every page (homepage had none) - Expand sitemap to emit separate entries for each locale - Add missing /docs/custom-commands to sitemap - Remove skipTrailingSlashRedirect to normalize trailing slashes - Block /_next/ in robots.txt to stop chunk crawling * Add per-page alternates to docs sub-pages and blog index Docs sub-pages and blog index only returned title/description in generateMetadata, so they inherited the parent layout's alternates (pointing to /docs or /blog). Now each page sets its own buildAlternates() with the correct path so canonical and hreflang point to the actual page URL. * Derive openGraph.url from buildAlternates to avoid drift * Redirect non-English legal pages to English, remove from sitemap Legal pages (privacy policy, TOS, EULA) are untranslated English content. Serving them under every locale creates 54 duplicate URLs. Now: - Middleware 301-redirects /ja/privacy-policy etc. to /privacy-policy - Sitemap only includes English URLs for legal pages (no locale variants) - Legal page metadata uses static English-only canonical * Fix legal page redirect to only match /<locale>/<page> paths endsWith matched too broadly (e.g. /docs/eula). Now only redirects when the path after the first segment is an exact legal page match. * Skip next-intl for legal pages to prevent locale redirect loop Without this, a Japanese user hitting /privacy-policy could be redirected by next-intl to /ja/privacy-policy, which our middleware redirects back to /privacy-policy, creating a loop. * Rewrite legal pages to /en/ instead of NextResponse.next() Pages live under app/[locale]/, so skipping next-intl entirely would break route resolution. Rewrite to /en/privacy-policy etc. so Next.js can resolve the [locale] segment correctly. --------- Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>
138 lines
3.7 KiB
TypeScript
138 lines
3.7 KiB
TypeScript
import { useTranslations } from "next-intl";
|
|
import { getTranslations } from "next-intl/server";
|
|
import { buildAlternates } from "../../../../i18n/seo";
|
|
import { CodeBlock } from "../../components/code-block";
|
|
import { Callout } from "../../components/callout";
|
|
|
|
export async function generateMetadata({ params }: { params: Promise<{ locale: string }> }) {
|
|
const { locale } = await params;
|
|
const t = await getTranslations({ locale, namespace: "docs.configuration" });
|
|
return {
|
|
title: t("metaTitle"),
|
|
description: t("metaDescription"),
|
|
alternates: buildAlternates(locale, "/docs/configuration"),
|
|
};
|
|
}
|
|
|
|
export default function ConfigurationPage() {
|
|
const t = useTranslations("docs.configuration");
|
|
|
|
return (
|
|
<>
|
|
<h1>{t("title")}</h1>
|
|
<p>{t("intro")}</p>
|
|
|
|
<h2>{t("configLocations")}</h2>
|
|
<p>{t("configLocationsDesc")}</p>
|
|
<ol>
|
|
<li>
|
|
<code>~/.config/ghostty/config</code>
|
|
</li>
|
|
<li>
|
|
<code>~/Library/Application Support/com.mitchellh.ghostty/config</code>
|
|
</li>
|
|
</ol>
|
|
<p>{t("createConfig")}</p>
|
|
<CodeBlock lang="bash">{`mkdir -p ~/.config/ghostty
|
|
touch ~/.config/ghostty/config`}</CodeBlock>
|
|
|
|
<h2>{t("appearance")}</h2>
|
|
|
|
<h3>{t("font")}</h3>
|
|
<CodeBlock title="~/.config/ghostty/config" lang="ini">{`font-family = JetBrains Mono
|
|
font-size = 14`}</CodeBlock>
|
|
|
|
<h3>{t("colors")}</h3>
|
|
<CodeBlock title="~/.config/ghostty/config" lang="ini">{`# Theme (or use individual colors below)
|
|
theme = Dracula
|
|
|
|
# Custom colors
|
|
background = #1e1e2e
|
|
foreground = #cdd6f4
|
|
cursor-color = #f5e0dc
|
|
cursor-text = #1e1e2e
|
|
selection-background = #585b70
|
|
selection-foreground = #cdd6f4`}</CodeBlock>
|
|
|
|
<h3>{t("splitPanes")}</h3>
|
|
<CodeBlock title="~/.config/ghostty/config" lang="ini">{`# Opacity for unfocused splits (0.0 to 1.0)
|
|
unfocused-split-opacity = 0.7
|
|
|
|
# Fill color for unfocused splits
|
|
unfocused-split-fill = #1e1e2e
|
|
|
|
# Divider color between splits
|
|
split-divider-color = #45475a`}</CodeBlock>
|
|
|
|
<h2>{t("behavior")}</h2>
|
|
|
|
<h3>{t("scrollback")}</h3>
|
|
<CodeBlock title="~/.config/ghostty/config" lang="ini">{`# Number of lines to keep in scrollback buffer
|
|
scrollback-limit = 10000`}</CodeBlock>
|
|
|
|
<h3>{t("workingDirectory")}</h3>
|
|
<CodeBlock title="~/.config/ghostty/config" lang="ini">{`# Default directory for new terminals
|
|
working-directory = ~/Projects`}</CodeBlock>
|
|
|
|
<h2>{t("appSettings")}</h2>
|
|
<p>{t("appSettingsDesc", { shortcut: "⌘," })}</p>
|
|
|
|
<h3>{t("themeMode")}</h3>
|
|
<ul>
|
|
<li>
|
|
<strong>{t("themeSystem")}</strong>
|
|
</li>
|
|
<li>
|
|
<strong>{t("themeLight")}</strong>
|
|
</li>
|
|
<li>
|
|
<strong>{t("themeDark")}</strong>
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>{t("automationMode")}</h3>
|
|
<p>{t("automationModeDesc")}</p>
|
|
<ul>
|
|
<li>
|
|
<strong>{t("automationOff")}</strong>
|
|
</li>
|
|
<li>
|
|
<strong>{t("automationCmux")}</strong>
|
|
</li>
|
|
<li>
|
|
<strong>{t("automationAll")}</strong>
|
|
</li>
|
|
</ul>
|
|
<Callout type="warn">{t("automationCallout")}</Callout>
|
|
|
|
<h3>{t("browserLinkBehavior")}</h3>
|
|
<p>{t("browserLinkDesc")}</p>
|
|
<ul>
|
|
<li>
|
|
<strong>{t("browserHostsEmbed")}</strong>
|
|
</li>
|
|
<li>
|
|
<strong>{t("browserHostsHttp")}</strong>
|
|
</li>
|
|
</ul>
|
|
|
|
<h2>{t("exampleConfig")}</h2>
|
|
<CodeBlock title="~/.config/ghostty/config" lang="ini">{`# Font
|
|
font-family = SF Mono
|
|
font-size = 13
|
|
|
|
# Colors
|
|
theme = One Dark
|
|
|
|
# Scrollback
|
|
scrollback-limit = 50000
|
|
|
|
# Splits
|
|
unfocused-split-opacity = 0.85
|
|
split-divider-color = #3e4451
|
|
|
|
# Working directory
|
|
working-directory = ~/code`}</CodeBlock>
|
|
</>
|
|
);
|
|
}
|