Skip to content

The Open Standard for Generative UI

docs: make gateway models page sections linkable (#1458)

devin-ai-integration[bot]b8fd785a125e
diff --git a/docs/app/(home)/cloud/gateway/models/ModelsTable.tsx b/docs/app/(home)/cloud/gateway/models/ModelsTable.tsx
index 20d5e9a42..cbbb81495 100644
--- a/docs/app/(home)/cloud/gateway/models/ModelsTable.tsx
+++ b/docs/app/(home)/cloud/gateway/models/ModelsTable.tsx
@@ -176,8 +176,20 @@ function compareModels(a: Model, b: Model, sort: Sort) {
return sort.dir === "asc" ? order : -order;
}
+// Tables grow when the model list loads, which moves the browser's initial #anchor scroll off target.
+function useScrollToHashOnLoad(loaded: boolean) {
+ useEffect(() => {
+ if (!loaded || !window.location.hash) return;
+ const frame = requestAnimationFrame(() => {
+ document.getElementById(decodeURIComponent(window.location.hash.slice(1)))?.scrollIntoView();
+ });
+ return () => cancelAnimationFrame(frame);
+ }, [loaded]);
+}
+
export function FreeModelsTable() {
const { data: models } = useRequest(getModels);
+ useScrollToHashOnLoad(models !== null);
const byId = useMemo(() => new Map((models ?? []).map((m) => [m.id, m])), [models]);
return (
diff --git a/docs/app/(home)/cloud/gateway/models/page.module.css b/docs/app/(home)/cloud/gateway/models/page.module.css
index 436277eee..72b505ab6 100644
--- a/docs/app/(home)/cloud/gateway/models/page.module.css
+++ b/docs/app/(home)/cloud/gateway/models/page.module.css
@@ -19,6 +19,8 @@
.section {
display: grid;
gap: 1.25rem;
+ /* Keeps #anchor targets clear of the sticky site header. */
+ scroll-margin-top: 6rem;
}
.sectionHeader {
@@ -50,6 +52,15 @@
text-underline-offset: 2px;
}
+.sectionHeader h2 a {
+ color: inherit;
+ text-decoration: none;
+}
+
+.sectionHeader h2 a:hover {
+ text-decoration: underline;
+}
+
.sectionHeader code {
font-family: var(--home-font-mono);
font-size: 0.875em;
diff --git a/docs/app/(home)/cloud/gateway/models/page.tsx b/docs/app/(home)/cloud/gateway/models/page.tsx
index 5fef612eb..36b9cae96 100644
--- a/docs/app/(home)/cloud/gateway/models/page.tsx
+++ b/docs/app/(home)/cloud/gateway/models/page.tsx
@@ -35,9 +35,11 @@ export default function GatewayModelsPage() {
/>
<div className={styles.content}>
- <section className={styles.section}>
+ <section className={styles.section} id="free-models">
<header className={styles.sectionHeader}>
- <h2>Free models</h2>
+ <h2>
+ <a href="#free-models">Free models</a>
+ </h2>
<p>
These models are promotionally free. Gateway does not charge for their tokens, but
each request still uses an API call from your plan. Free models are rate limited, and
@@ -49,17 +51,21 @@ export default function GatewayModelsPage() {
</section>
{PROVIDER_SECTIONS.map((p) => (
- <section className={styles.section} key={p.group}>
+ <section className={styles.section} key={p.group} id={p.group}>
<header className={styles.sectionHeader}>
- <h2>{p.title}</h2>
+ <h2>
+ <a href={`#${p.group}`}>{p.title}</a>
+ </h2>
</header>
<ModelsTable group={p.group} preview={5} pageSize={15} />
</section>
))}
- <section className={styles.section}>
+ <section className={styles.section} id="other-models">
<header className={styles.sectionHeader}>
- <h2>Other models</h2>
+ <h2>
+ <a href="#other-models">Other models</a>
+ </h2>
<p>
OpenUI Gateway serves third-party models from providers other than OpenAI, Anthropic,
and Google Gemini through OpenRouter. To require{" "}