Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

feat: add feature flagging for homepage text & logo (#39080)

Charis0719f4f072fc
diff --git a/apps/docs/components/HomePageCover.tsx b/apps/docs/components/HomePageCover.tsx
index 3cb33e4ed5c..5e35276d153 100644
--- a/apps/docs/components/HomePageCover.tsx
+++ b/apps/docs/components/HomePageCover.tsx
@@ -2,11 +2,12 @@
import { ChevronRight, Play, Sparkles } from 'lucide-react'
import Link from 'next/link'
+// End of third-party imports
import { isFeatureEnabled, useBreakpoint } from 'common'
import { cn, IconBackground } from 'ui'
import { IconPanel } from 'ui-patterns/IconPanel'
-
+import { useCustomContent } from '../hooks/custom-content/useCustomContent'
import DocsCoverLogo from './DocsCoverLogo'
const { sdkDart: sdkDartEnabled, sdkKotlin: sdkKotlinEnabled } = isFeatureEnabled([
@@ -36,6 +37,7 @@ function AiPrompt({ className }: { className?: string }) {
const HomePageCover = (props) => {
const isXs = useBreakpoint(639)
const iconSize = isXs ? 'sm' : 'lg'
+ const { homepageHeading } = useCustomContent(['homepage:heading'])
const frameworks = [
{
@@ -141,7 +143,9 @@ const HomePageCover = (props) => {
<div className="flex flex-col sm:flex-row gap-4 sm:gap-8 items-start sm:items-center w-full max-w-xl xl:max-w-[33rem]">
<DocsCoverLogo aria-hidden="true" />
<div className="flex flex-col">
- <h1 className="m-0 mb-3 text-2xl sm:text-3xl text-foreground">{props.title}</h1>
+ <h1 className="m-0 mb-3 text-2xl sm:text-3xl text-foreground">
+ {homepageHeading || props.title}
+ </h1>
<p className="m-0 text-foreground-light">
Learn how to get up and running with Supabase through tutorials, APIs and platform
resources.
diff --git a/apps/docs/components/Navigation/NavigationMenu/TopNavBar.tsx b/apps/docs/components/Navigation/NavigationMenu/TopNavBar.tsx
index 2655bb509c6..195983325d9 100644
--- a/apps/docs/components/Navigation/NavigationMenu/TopNavBar.tsx
+++ b/apps/docs/components/Navigation/NavigationMenu/TopNavBar.tsx
@@ -1,17 +1,18 @@
-import { memo, useState } from 'react'
+import { Command, Menu, Search } from 'lucide-react'
import dynamic from 'next/dynamic'
import Image from 'next/image'
import Link from 'next/link'
-import { Command, Search, Menu } from 'lucide-react'
+import type { FC } from 'react'
+import { memo, useState } from 'react'
+// End of third-party imports
import { useIsLoggedIn, useIsUserLoading, useUser } from 'common'
import { Button, buttonVariants, cn } from 'ui'
import { AuthenticatedDropdownMenu, CommandMenuTrigger } from 'ui-patterns'
+import { useCustomContent } from '../../../hooks/custom-content/useCustomContent'
import GlobalNavigationMenu from './GlobalNavigationMenu'
import useDropdownMenu from './useDropdownMenu'
-import type { FC } from 'react'
-
const GlobalMobileMenu = dynamic(() => import('./GlobalMobileMenu'))
const TopNavDropdown = dynamic(() => import('./TopNavDropdown'))
@@ -55,7 +56,8 @@ const TopNavBar: FC = () => {
<div className="flex items-center space-x-2 text-foreground-muted">
<Search size={18} strokeWidth={2} />
<p className="flex text-sm pr-2">
- Search<span className="hidden xl:inline ml-1"> docs...</span>
+ Search
+ <span className="hidden xl:inline ml-1"> docs...</span>
</p>
</div>
<div className="hidden md:flex items-center space-x-1">
@@ -108,6 +110,8 @@ const TopNavBar: FC = () => {
}
const HeaderLogo = memo(() => {
+ const { navigationLogoUrl } = useCustomContent(['navigation:logo_url'])
+
return (
<Link
href="/"
@@ -118,7 +122,7 @@ const HeaderLogo = memo(() => {
>
<Image
className="hidden dark:block !m-0"
- src="/docs/supabase-dark.svg"
+ src={navigationLogoUrl?.dark ?? '/docs/supabase-dark.svg'}
priority={true}
loading="eager"
width={96}
@@ -127,7 +131,7 @@ const HeaderLogo = memo(() => {
/>
<Image
className="block dark:hidden !m-0"
- src="/docs/supabase-light.svg"
+ src={navigationLogoUrl?.light ?? '/docs/supabase-light.svg'}
priority={true}
loading="eager"
width={96}
diff --git a/apps/docs/hooks/custom-content/CustomContent.types.ts b/apps/docs/hooks/custom-content/CustomContent.types.ts
new file mode 100644
index 00000000000..ece890f25da
--- /dev/null
+++ b/apps/docs/hooks/custom-content/CustomContent.types.ts
@@ -0,0 +1,7 @@
+export type CustomContentTypes = {
+ homepageHeading: string
+ navigationLogoUrl: {
+ light: string
+ dark: string
+ }
+}
diff --git a/apps/docs/hooks/custom-content/custom-content.json b/apps/docs/hooks/custom-content/custom-content.json
new file mode 100644
index 00000000000..b6fe8d9eea6
--- /dev/null
+++ b/apps/docs/hooks/custom-content/custom-content.json
@@ -0,0 +1,7 @@
+{
+ "homepage:heading": "Supabase Documentation",
+ "navigation:logo_url": {
+ "light": "/docs/supabase-light.svg",
+ "dark": "/docs/supabase-dark.svg"
+ }
+}
diff --git a/apps/docs/hooks/custom-content/useCustomContent.test.ts b/apps/docs/hooks/custom-content/useCustomContent.test.ts
new file mode 100644
index 00000000000..049d3eb4504
--- /dev/null
+++ b/apps/docs/hooks/custom-content/useCustomContent.test.ts
@@ -0,0 +1,48 @@
+/*
+ * @vitest-environment jsdom
+ */
+
+import { cleanup, renderHook } from '@testing-library/react'
+import { beforeEach, describe, expect, it, vi } from 'vitest'
+
+beforeEach(() => {
+ vi.clearAllMocks()
+ vi.resetModules()
+ cleanup()
+})
+
+describe('useCustomContent', () => {
+ it('should return null if content is not found in the custom-content.json file', async () => {
+ vi.doMock('./custom-content.json', () => ({
+ default: {
+ 'navigation:logo_url': null,
+ },
+ }))
+
+ const { useCustomContent } = await import('./useCustomContent')
+ const { result } = renderHook(() => useCustomContent(['navigation:logo_url']))
+ expect(result.current.navigationLogoUrl).toEqual(null)
+ })
+
+ it('should return the content for the key passed in if it exists in the custom-content.json file', async () => {
+ vi.doMock('./custom-content.json', () => ({
+ default: {
+ 'navigation:logo_url': {
+ light: 'https://example.com/logo-light.svg',
+ dark: 'https://example.com/logo-dark.svg',
+ },
+ 'homepage:heading': 'Custom Heading',
+ },
+ }))
+
+ const { useCustomContent } = await import('./useCustomContent')
+ const { result } = renderHook(() =>
+ useCustomContent(['navigation:logo_url', 'homepage:heading'])
+ )
+ expect(result.current.navigationLogoUrl).toEqual({
+ light: 'https://example.com/logo-light.svg',
+ dark: 'https://example.com/logo-dark.svg',
+ })
+ expect(result.current.homepageHeading).toEqual('Custom Heading')
+ })
+})
diff --git a/apps/docs/hooks/custom-content/useCustomContent.ts b/apps/docs/hooks/custom-content/useCustomContent.ts
new file mode 100644
index 00000000000..d88a73339a1
--- /dev/null
+++ b/apps/docs/hooks/custom-content/useCustomContent.ts
@@ -0,0 +1,49 @@
+/*
+ * [Charis 2025-09-29] This file is a duplicate of studio's useCustomContent.ts
+ * for now.
+ *
+ * We should probably consolidate these two files in the future, but we want to
+ * get this change shipped quickly without worrying about smoke testing all the
+ * components affected by a refactor.
+ */
+
+import type { CustomContentTypes } from './CustomContent.types'
+import customContentRaw from './custom-content.json'
+
+const customContentStaticObj = customContentRaw as Omit<typeof customContentRaw, '$schema'>
+type CustomContent = keyof typeof customContentStaticObj
+
+type SnakeToCamelCase<S extends string> = S extends `${infer First}_${infer Rest}`
+ ? `${First}${SnakeToCamelCase<Capitalize<Rest>>}`
+ : S
+
+type CustomContentToCamelCase<S extends CustomContent> = S extends `${infer P}:${infer R}`
+ ? `${SnakeToCamelCase<P>}${Capitalize<SnakeToCamelCase<R>>}`
+ : SnakeToCamelCase<S>
+
+function contentToCamelCase(feature: CustomContent) {
+ return feature
+ .replace(/:/g, '_')
+ .split('_')
+ .map((word, index) => (index === 0 ? word : word[0].toUpperCase() + word.slice(1)))
+ .join('') as CustomContentToCamelCase<typeof feature>
+}
+
+const useCustomContent = <T extends CustomContent[]>(
+ contents: T
+): {
+ [key in CustomContentToCamelCase<T[number]>]:
+ | CustomContentTypes[CustomContentToCamelCase<T[number]>]
+ | null
+} => {
+ // [Joshen] Running into some TS errors without the `as` here - must be overlooking something super simple
+ return Object.fromEntries(
+ contents.map((content) => [contentToCamelCase(content), customContentStaticObj[content]])
+ ) as {
+ [key in CustomContentToCamelCase<T[number]>]:
+ | CustomContentTypes[CustomContentToCamelCase<T[number]>]
+ | null
+ }
+}
+
+export { useCustomContent }
diff --git a/apps/docs/package.json b/apps/docs/package.json
index 02133c145f0..17a773cb51d 100644
--- a/apps/docs/package.json
+++ b/apps/docs/package.json
@@ -128,6 +128,7 @@
"@graphql-codegen/typescript": "4.1.6",
"@graphql-codegen/typescript-resolvers": "4.5.0",
"@supabase/supa-mdx-lint": "0.3.1",
+ "@testing-library/react": "^16.0.0",
"@types/common-tags": "^1.8.4",
"@types/estree": "1.0.5",
"@types/graphql-validation-complexity": "^0.4.4",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 7747007f4ff..d39f2183939 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -382,7 +382,7 @@ importers:
'@sentry/nextjs':
specifier: ^10.3.0
'@supabase/supabase-js':
specifier: 'catalog:'
version: 2.49.3
@@ -600,6 +600,9 @@ importers:
'@supabase/supa-mdx-lint':
specifier: 0.3.1
version: 0.3.1
+ '@testing-library/react':
+ specifier: ^16.0.0
'@types/common-tags':
specifier: ^1.8.4
version: 1.8.4
@@ -794,7 +797,7 @@ importers:
'@sentry/nextjs':
specifier: ^10.3.0
'@std/path':
specifier: npm:@jsr/std__path@^1.0.8
version: '@jsr/[email protected]'
@@ -929,13 +932,13 @@ importers:
version: 0.52.2
next:
specifier: 'catalog:'
next-themes:
specifier: ^0.3.0
nuqs:
specifier: ^2.4.1
openai:
specifier: ^4.75.1
@@ -1206,7 +1209,7 @@ importers:
version: 2.4.11([email protected])
next-router-mock:
specifier: ^0.9.13
node-mocks-http:
specifier: ^1.17.2
version: 1.17.2(@types/[email protected])
@@ -1570,7 +1573,7 @@ importers:
'@sentry/nextjs':
specifier: ^10
'@supabase/supabase-js':
specifier: 'catalog:'
version: 2.49.3
@@ -2511,7 +2514,7 @@ importers:
version: link:../api-types
next-router-mock:
specifier: ^0.9.13
tsx:
specifier: ^4.19.3
version: 4.19.3
@@ -23294,7 +23297,7 @@ snapshots:
'@jridgewell/[email protected]':
dependencies:
'@jridgewell/resolve-uri': 3.1.2
- '@jridgewell/sourcemap-codec': 1.5.0
+ '@jridgewell/sourcemap-codec': 1.5.5
optional: true
'@js-sdsl/[email protected]': {}
@@ -27775,7 +27778,33 @@ snapshots:
'@sentry/[email protected]': {}
+ dependencies:
+ '@opentelemetry/api': 1.9.0
+ '@opentelemetry/semantic-conventions': 1.36.0
+ '@rollup/plugin-commonjs': 28.0.1([email protected])
+ '@sentry-internal/browser-utils': 10.3.0
+ '@sentry/core': 10.3.0
+ '@sentry/node': 10.3.0([email protected])
+ '@sentry/opentelemetry': 10.3.0(@opentelemetry/[email protected])(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected])
+ '@sentry/react': 10.3.0([email protected])
+ '@sentry/vercel-edge': 10.3.0
+ '@sentry/webpack-plugin': 4.0.2([email protected])([email protected])([email protected])
+ chalk: 3.0.0
+ resolve: 1.22.8
+ rollup: 4.38.0
+ stacktrace-parser: 0.1.10
+ transitivePeerDependencies:
+ - '@opentelemetry/context-async-hooks'
+ - '@opentelemetry/core'
+ - '@opentelemetry/sdk-trace-base'
+ - encoding
+ - react
+ - supports-color
+ - webpack
+
dependencies:
'@opentelemetry/api': 1.9.0
'@opentelemetry/semantic-conventions': 1.36.0
@@ -29334,7 +29363,7 @@ snapshots:
'@testing-library/[email protected]':
dependencies:
- '@babel/code-frame': 7.26.2
+ '@babel/code-frame': 7.27.1
'@babel/runtime': 7.26.10
'@types/aria-query': 5.0.2
aria-query: 5.3.0
@@ -30591,7 +30620,7 @@ snapshots:
dependencies:
- acorn: 8.14.1
+ acorn: 8.15.0
acorn-walk: 8.3.4
optional: true
@@ -30599,6 +30628,10 @@ snapshots:
dependencies:
acorn: 8.14.1
+ dependencies:
+ acorn: 8.15.0
+
dependencies:
acorn: 8.11.3
@@ -34366,7 +34399,7 @@ snapshots:
dependencies:
'@tootallnate/once': 2.0.0
agent-base: 6.0.2([email protected])
- debug: 4.4.0([email protected])
+ debug: 4.4.3([email protected])
transitivePeerDependencies:
- supports-color
optional: true
@@ -35096,7 +35129,7 @@ snapshots:
dependencies:
abab: 2.0.6
- acorn: 8.14.1
+ acorn: 8.15.0
acorn-globals: 7.0.1
cssom: 0.5.0
cssstyle: 2.3.0
@@ -36963,7 +36996,12 @@ snapshots:
dependencies:
js-yaml-loader: 1.2.2
+ dependencies:
+ react: 18.3.1
+
dependencies:
react: 18.3.1
@@ -36981,6 +37019,32 @@ snapshots:
+ dependencies:
+ '@next/env': 15.5.2
+ '@swc/helpers': 0.5.15
+ caniuse-lite: 1.0.30001695
+ postcss: 8.4.31
+ react: 18.3.1
+ react-dom: 18.3.1([email protected])
+ optionalDependencies:
+ '@next/swc-darwin-arm64': 15.5.2
+ '@next/swc-darwin-x64': 15.5.2
+ '@next/swc-linux-arm64-gnu': 15.5.2
+ '@next/swc-linux-arm64-musl': 15.5.2
+ '@next/swc-linux-x64-gnu': 15.5.2
+ '@next/swc-linux-x64-musl': 15.5.2
+ '@next/swc-win32-arm64-msvc': 15.5.2
+ '@next/swc-win32-x64-msvc': 15.5.2
+ '@opentelemetry/api': 1.9.0
+ '@playwright/test': 1.53.0
+ sass: 1.77.4
+ sharp: 0.34.3
+ transitivePeerDependencies:
+ - '@babel/core'
+ - babel-plugin-macros
+
dependencies:
'@next/env': 15.5.2
@@ -37433,12 +37497,12 @@ snapshots:
mitt: 3.0.1
dependencies:
mitt: 3.0.1
react: 18.3.1
optionalDependencies:
@@ -40812,6 +40876,13 @@ snapshots:
stylis: 4.3.1
tslib: 2.5.0
+ dependencies:
+ client-only: 0.0.1
+ react: 18.3.1
+ optionalDependencies:
+ '@babel/core': 7.26.10([email protected])
+
dependencies:
client-only: 0.0.1
@@ -41023,7 +41094,7 @@ snapshots:
dependencies:
- '@jridgewell/trace-mapping': 0.3.25
+ '@jridgewell/trace-mapping': 0.3.31
jest-worker: 27.5.1
schema-utils: 4.3.0
serialize-javascript: 6.0.2
@@ -41035,7 +41106,7 @@ snapshots:
dependencies:
- '@jridgewell/trace-mapping': 0.3.25
+ '@jridgewell/trace-mapping': 0.3.31
jest-worker: 27.5.1
schema-utils: 4.3.0
serialize-javascript: 6.0.2
@@ -41248,7 +41319,7 @@ snapshots:
'@tsconfig/node14': 1.0.3
'@tsconfig/node16': 1.0.4
'@types/node': 22.13.14
- acorn: 8.14.1
+ acorn: 8.15.0
acorn-walk: 8.3.4
arg: 4.1.3
create-require: 1.1.1
@@ -42631,12 +42702,12 @@ snapshots:
'@webassemblyjs/ast': 1.14.1
'@webassemblyjs/wasm-edit': 1.14.1
'@webassemblyjs/wasm-parser': 1.14.1
- acorn: 8.14.1
- acorn-import-attributes: 1.9.5([email protected])
- browserslist: 4.24.4
+ acorn: 8.15.0
+ acorn-import-attributes: 1.9.5([email protected])
+ browserslist: 4.26.2
chrome-trace-event: 1.0.4
enhanced-resolve: 5.18.1
- es-module-lexer: 1.6.0
+ es-module-lexer: 1.7.0
eslint-scope: 5.1.1
events: 3.3.0
glob-to-regexp: 0.4.1
@@ -42661,12 +42732,12 @@ snapshots:
'@webassemblyjs/ast': 1.14.1
'@webassemblyjs/wasm-edit': 1.14.1
'@webassemblyjs/wasm-parser': 1.14.1
- acorn: 8.14.1
- acorn-import-attributes: 1.9.5([email protected])
- browserslist: 4.24.4
+ acorn: 8.15.0
+ acorn-import-attributes: 1.9.5([email protected])
+ browserslist: 4.26.2
chrome-trace-event: 1.0.4
enhanced-resolve: 5.18.1
- es-module-lexer: 1.6.0
+ es-module-lexer: 1.7.0
eslint-scope: 5.1.1
events: 3.3.0
glob-to-regexp: 0.4.1