Skip to content

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

fix(docs): troubleshooting ui cleanup (#30951)

Charis719c28f31ea3
diff --git a/apps/docs/features/docs/Troubleshooting.ui.tsx b/apps/docs/features/docs/Troubleshooting.ui.tsx
index 3448846e663..80693679204 100644
--- a/apps/docs/features/docs/Troubleshooting.ui.tsx
+++ b/apps/docs/features/docs/Troubleshooting.ui.tsx
@@ -34,7 +34,7 @@ export async function TroubleshootingPreview({ entry }: { entry: ITroubleshootin
{...attributes}
>
<div className="flex flex-wrap items-start gap-x-2 gap-y-4 justify-between">
- <div className="flex-grow flex flex-col gap-2">
+ <div className="max-w-[60%] flex flex-col gap-2">
<Link
href={`/guides/troubleshooting/${getArticleSlug(entry)}`}
className={cn('visited:text-foreground-lighter', 'before:absolute before:inset-0')}
@@ -48,12 +48,15 @@ export async function TroubleshootingPreview({ entry }: { entry: ITroubleshootin
</Link>
{entry.data.errors?.length > 0 && (
<span className="text-xs text-foreground-lighter">
- {entry.data.errors.map((error, index) => (
- <>
- <code key={index}>{formatError(error)}</code>
- {index < entry.data.errors.length - 1 && ', '}
- </>
- ))}
+ {entry.data.errors
+ .map(formatError)
+ .filter(Boolean)
+ .map((error, index) => (
+ <>
+ <code key={index}>{error}</code>
+ {index < entry.data.errors.length - 1 ? ', ' : ''}
+ </>
+ ))}
</span>
)}
</div>
diff --git a/apps/docs/features/docs/Troubleshooting.utils.shared.ts b/apps/docs/features/docs/Troubleshooting.utils.shared.ts
index 2e87d428850..5e804f76236 100644
--- a/apps/docs/features/docs/Troubleshooting.utils.shared.ts
+++ b/apps/docs/features/docs/Troubleshooting.utils.shared.ts
@@ -12,7 +12,7 @@ export const TROUBLESHOOTING_DATA_ATTRIBUTES = {
}
export function formatError(error: ITroubleshootingEntry['data']['errors'][number]) {
- return `${error.http_status_code ?? ''}${!!error.http_status_code && !!error.code && ' '}${error.code ?? ''}`
+ return `${error.http_status_code ?? ''}${!!error.http_status_code && !!error.code ? ' ' : ''}${error.code ?? ''}`
}
export const troubleshootingSearchParams = {
diff --git a/apps/docs/internals/generate-sitemap.ts b/apps/docs/internals/generate-sitemap.ts
index 876507a4719..f1d37d6d8b5 100644
--- a/apps/docs/internals/generate-sitemap.ts
+++ b/apps/docs/internals/generate-sitemap.ts
@@ -15,7 +15,7 @@ async function generate() {
const cliPages = generateCLIPages()
const referencePages = await generateReferencePages()
- const contentFiles = await globby(['content/**/!(_)*.mdx'])
+ const contentFiles = await globby(['content/guides/**/!(_)*.mdx'])
const contentPages = await Promise.all(
contentFiles.map(async (filePath) => {
const fileContents = await fs.promises.readFile(filePath, 'utf8')
@@ -30,7 +30,18 @@ async function generate() {
})
)
+ const troubleshootingFiles = await globby(['content/troubleshooting/**/!(_)*.mdx'])
+ const troubleshootingPages = await Promise.all(
+ troubleshootingFiles.map(async (filePath) => {
+ return {
+ link: filePath.replace(/^content/, 'guides').replace(/\.mdx$/, ''),
+ priority: 1,
+ }
+ })
+ )
+
const allPages = (contentPages as Array<{ link: string; priority?: number }>).concat(
+ troubleshootingPages,
referencePages,
cliPages
)