-
Notifications
You must be signed in to change notification settings - Fork 131
Enhance documentation and SEO for brand assets #543
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,59 @@ | ||
| # `editor` | ||
|
|
||
| ## Universal routing (docs-friendly links) | ||
| This package is the Next.js app that powers **`grida.co`** and tenant domains (e.g. `xyz.grida.site`, custom domains). | ||
|
|
||
| Grida supports **universal routing** so documentation can link to stable, tenant-agnostic URLs like `https://grida.co/_/<path>` and have them resolved to canonical tenant/document routes at runtime. | ||
| - This doc is a curated “where to change what” map. It’s intentionally **not** exhaustive. | ||
|
|
||
| - When you add a **new user-facing page** that should be referenced from docs, ensure it is registered in **universal routing**. | ||
| - When debugging docs links that point to the editor, start from the universal routing spec: `docs/wg/platform/universal-docs-routing.md`. | ||
| ## Key rules (things that bite later) | ||
|
|
||
| - **Auth is special**: `app/(auth)` is security-critical. **Do not modify** routes/flows there. | ||
| - **Public API is versioned**: treat `app/(api)/(public)/v1` as **backwards-compatible** (additive changes only unless you’re intentionally breaking/v2-ing). | ||
| - **Layouts are per route group**: there isn’t a single shared root layout across the whole `app/` tree — top-level route groups own their root `layout.tsx`/metadata. | ||
| - **Edge entrypoint is `proxy.ts`**: on Next.js 16 this replaces `middleware.ts` (same runtime + semantics). Don’t add a new `middleware.ts`. | ||
| - **Tenant pages are tenant-aware**: follow [`app/(tenant)/README.md`](<app/(tenant)/README.md>) for host-prefixed fetches (`server.HOST` / `web.HOST`) and tenant-friendly `href="/path"` patterns. | ||
| - **Shared UI boundaries matter**: | ||
| - `components/` should remain route-agnostic and override-friendly (see [`components/AGENTS.md`](components/AGENTS.md)) | ||
| - `kits/` are stateful “drop-in widgets” that must not couple to global editor/workbench state (see [`kits/AGENTS.md`](kits/AGENTS.md)) | ||
| - `scaffolds/` are feature assemblies and may bind to global/editor state | ||
| - **Stable public asset URLs**: put canonical assets under `public/` (e.g. `/brand/...png`) when you need a durable, crawlable, cache-friendly path. (If you care about image search quirks, see [`app/(www)/SEO.md`](<app/(www)/SEO.md>).) | ||
|
|
||
| ## Directory map | ||
|
|
||
| ### Editor root (selected) | ||
|
|
||
| | Path | What lives here | Guide | Notes | | ||
| | ------------- | ------------------------------------------- | ---------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| | `app/` | Next.js App Router routes | — | Route groups are listed below. Main sitemap: [`app/sitemap.ts`](app/sitemap.ts). | | ||
| | `www/` | Public-site components for `(www)` | — | Header/footer + landing components. Nav config: [`www/data/sitemap.ts`](www/data/sitemap.ts) (despite the name, it’s **not** `sitemap.xml`). | | ||
| | `components/` | Shared UI building blocks | [`components/AGENTS.md`](components/AGENTS.md) | Route-agnostic, override-friendly components. Includes primitives under `components/ui/*` and related subdirectories. | | ||
| | `scaffolds/` | Feature-sized UI assemblies | — | Bigger, feature-scoped assemblies (often app-coupled). | | ||
| | `lib/` | Stable, non-opinionated modules | — | Good candidates to promote to `/packages` once matured. | | ||
| | `grida-*` | Large domain folders (e.g. `grida-canvas*`) | — | Editor-local domain implementations that may be promoted into `/packages` once stabilized. | | ||
| | `kits/` | Stateful “drop-in” widgets | [`kits/AGENTS.md`](kits/AGENTS.md) | Opinionated, state-rich UI modules: stateful inside the kit, simple API for consumers. No route/global-store coupling. | | ||
| | `theme/` | Templates and themes | — | Email templates, enterprise templates, etc. | | ||
| | `public/` | Static assets | — | Use for **stable public asset URLs** (e.g. `/brand/...png`). | | ||
|
|
||
| ### `app/` route groups (selected) | ||
|
|
||
| | Route group | Used for | Guide | Notes / rules | | ||
| | ------------- | ------------------------------------------------------ | ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| | `(workbench)` | Core editor / workbench | — | Performance-sensitive. Keep `use client` boundaries narrow and avoid heavy deps in shared layouts. | | ||
| | `(workspace)` | Dashboard / org & project management | — | Similar constraints as `(workbench)`; avoid pushing heavyweight client code into shared layouts. | | ||
| | `(tenant)` | Tenant-rooted routes (custom domains / `*.grida.site`) | [`app/(tenant)/README.md`](<app/(tenant)/README.md>) | Tenant-aware routing + host-prefixed fetch rules (`server.HOST` / `web.HOST`). | | ||
| | `(api)` | Route handlers (public + private) | — | Public: `app/(api)/(public)/v1` (treat as stable). Private: `app/(api)/private` (first-party). Private editor web APIs live under `app/(api)/private/editor` (see `README.md`). | | ||
| | `(auth)` | Auth flow routes | — | **Do not modify.** | | ||
| | `(tools)` | Standalone tools | — | Tools live under `app/(tools)/tools/*`. Some tools include a local `AGENTS.md` (example: [`halftone`](<app/(tools)/tools/halftone/AGENTS.md>)). | | ||
| | `(preview)` | Embed/preview surfaces | — | Read-only previews and embed-purpose routes (often consumed by tools/playground). | | ||
| | `(library)` | Library (open assets) pages | — | Library browsing/marketing routes. | | ||
| | `(www)` | Public marketing / SEO pages | [`app/(www)/SEO.md`](<app/(www)/SEO.md>) | Public `grida.co` landing pages and SEO-first routes. | | ||
| | `(site)` | Public pages not SEO-first | — | Public routes that aren’t primarily marketing/SEO. | | ||
| | `(insiders)` | Insider/local-only routes | — | Local-only/internal tooling and flows. Don’t depend on these for production UX. | | ||
| | `(dev)` | Dev-only pages/tools | — | Development-only routes; avoid linking from production UI. | | ||
|
|
||
| ## Navigation, sitemaps, and docs links | ||
|
|
||
| - **Header/nav config**: [`www/data/sitemap.ts`](www/data/sitemap.ts) (drives `www/header.tsx`; despite the name, this is **not** `sitemap.xml`) | ||
| - **`sitemap.xml` generator**: [`app/sitemap.ts`](app/sitemap.ts) (Next.js `MetadataRoute.Sitemap` for `grida.co`; tenant routes are handled separately) | ||
| - **Universal routing (docs-friendly links)**: [`../docs/wg/platform/universal-docs-routing.md`](../docs/wg/platform/universal-docs-routing.md) | ||
| - When docs link to editor pages, prefer `https://grida.co/_/<path>`. | ||
| - If you add a new user-facing page that docs should reference, ensure it’s registered in universal routing. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| ### SEO gotchas for `editor/app/(www)` (not the basics) | ||
|
|
||
| This doc exists to record **easy-to-miss stack-specific issues** and **our preferred tricks**. | ||
|
|
||
| --- | ||
|
|
||
| ### Google Image Search gotcha: Next.js `<Image>` hides the “real” image URL | ||
|
|
||
| **Symptom:** the page ranks (e.g. “Grida logo png”), but **Google Images doesn’t surface the logo assets** from that page. | ||
|
|
||
| **Cause:** Next.js `<Image>` commonly renders an optimized `src` like: | ||
|
|
||
| - `/_next/image?url=%2Fbrand%2Fgrida-symbol-240.png&w=...&q=...` | ||
|
|
||
| Google Images indexes the asset more reliably when the rendered `img src` is a **stable public URL** such as `/brand/...png` rather than only an optimized proxy URL. | ||
|
|
||
| **Our trick (for brand/press/asset pages):** ensure the rendered `img src` is a **direct, stable, public asset URL**. | ||
|
|
||
| - **Preferred**: keep `<Image>`, but add `unoptimized` for SEO-critical assets. | ||
| - **Alternative**: use a plain `<img>` when you want to be maximally explicit. | ||
|
|
||
| **Apply to:** pages where the images themselves are the query target (“logo png”, brand assets, downloads). | ||
|
|
||
| **Sanity checklist:** | ||
|
|
||
| - **Public**: returns **200** without cookies; not blocked for `Googlebot-Image` | ||
| - **Correct `Content-Type`**: `image/png`, `image/svg+xml`, etc. | ||
| - **Not blocked by robots**: `robots.txt` and `X-Robots-Tag` | ||
| - **`/_next/image` is fetchable**: not blocked by robots, authentication, or middleware (other pages may still rely on the optimizer) | ||
| - **Stable, clean URLs**: prefer `public/` paths like `/brand/...` (avoid query-string-only canonical asset URLs) | ||
| - **Alt text**: include “Grida” + asset name + format (e.g. “Grida wordmark logo (PNG)”) | ||
|
|
||
| **Reminder:** JSON-LD / Open Graph help, but they **don’t replace** crawlable image URLs in the HTML for Image Search. | ||
|
|
||
| --- | ||
|
|
||
| ### Image search boost: sitemap + canonical URL | ||
|
|
||
| - **Image sitemap**: include brand PNGs in the image sitemap (one entry per canonical asset URL). | ||
| - **Canonical**: keep a single, clean canonical `/brand` URL (avoid duplicates, tracking params, and competing alternates). | ||
|
|
||
| --- | ||
|
|
||
| ### Next.js metadata: relative OG/Twitter images need `metadataBase` | ||
|
|
||
| OG/Twitter images must resolve to **absolute public URLs** that return **200** without auth. | ||
|
|
||
| If `openGraph.images` uses relative paths in Next.js metadata, `metadataBase` is required so crawlers see correct absolute URLs. | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🧩 Analysis chain
🌐 Web query:
Next.js 16 proxy.ts middleware replacement💡 Result:
In Next.js 16,
proxy.tsreplacesmiddleware.tsfor request interception on the Node.js runtime (to make the “network boundary” explicit). To migrate, renamemiddleware.ts→proxy.tsand rename your exported function toproxy—the logic can stay the same. [1][2]Migration (recommended):
npx@next/codemod@canary middleware-to-proxy .[2]Note:
middleware.tsstill exists for Edge runtime use cases, but it’s deprecated and planned for removal in a future version. [1]Sources:
[1] Next.js 16 blog (proxy.ts formerly middleware.ts)
[2] Next.js docs message: Renaming Middleware to Proxy
Clarify the runtime distinction for
proxy.tsvsmiddleware.tsin Next.js 16.The guidance on line 12 is mostly correct but incomplete.
proxy.tsreplacesmiddleware.tsfor Node.js runtime in Next.js 16 with equivalent semantics (function logic remains the same—just rename the export toproxy). However,middleware.tsstill exists for Edge runtime use cases (though deprecated). Expand the note to clarify this distinction so developers understand when to use each approach.🤖 Prompt for AI Agents