mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
fix(site): resolve api reference slug mismatch on airplay and hlsjs pages (#1755)
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
---
|
||||
import { getEntry } from 'astro:content';
|
||||
import { kebabCase } from 'es-toolkit/string';
|
||||
import ContentWidth from '@/components/frames/ContentWidth.astro';
|
||||
import H2 from '@/components/typography/H2Markdown.astro';
|
||||
import H3 from '@/components/typography/H3Markdown.astro';
|
||||
@@ -9,6 +8,7 @@ import MarkdownCode from '@/components/typography/MarkdownCode.astro';
|
||||
import P from '@/components/typography/P.astro';
|
||||
import type { ComponentReference } from '@/types/component-reference';
|
||||
import { isValidFramework } from '@/types/docs';
|
||||
import { resolveReferenceSlug } from '@/utils/api-reference-overrides';
|
||||
import { createComponentReferenceModel } from '@/utils/componentReferenceModel';
|
||||
import FrameworkCase from '../FrameworkCase.astro';
|
||||
import ApiCSSVarsTable from './ApiCSSVarsTable.astro';
|
||||
@@ -28,7 +28,7 @@ if (!framework || !isValidFramework(framework)) {
|
||||
throw new Error(`Invalid or missing framework param.`);
|
||||
}
|
||||
|
||||
const entry = await getEntry('componentReference', kebabCase(component));
|
||||
const entry = await getEntry('componentReference', resolveReferenceSlug(component));
|
||||
const apiRef: ComponentReference | null = entry?.data ?? null;
|
||||
if (!apiRef) return;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
---
|
||||
import { getEntry } from 'astro:content';
|
||||
import { kebabCase } from 'es-toolkit/string';
|
||||
import ContentWidth from '@/components/frames/ContentWidth.astro';
|
||||
import A from '@/components/typography/A.astro';
|
||||
import H2 from '@/components/typography/H2Markdown.astro';
|
||||
@@ -14,6 +13,7 @@ import Th from '@/components/typography/Th.astro';
|
||||
import Thead from '@/components/typography/Thead.astro';
|
||||
import Tr from '@/components/typography/Tr.astro';
|
||||
import type { MediaReference } from '@/types/media-reference';
|
||||
import { resolveReferenceSlug } from '@/utils/api-reference-overrides';
|
||||
import { createMediaReferenceModel } from '@/utils/mediaReferenceModel';
|
||||
import ApiCSSVarsTable from './ApiCSSVarsTable.astro';
|
||||
import CodeChip from './CodeChip.astro';
|
||||
@@ -26,7 +26,7 @@ interface Props {
|
||||
const { media } = Astro.props;
|
||||
const framework = Astro.params.framework === 'react' ? 'react' : 'html';
|
||||
|
||||
const entry = await getEntry('mediaReference', kebabCase(media));
|
||||
const entry = await getEntry('mediaReference', resolveReferenceSlug(media));
|
||||
const ref: MediaReference | null = entry?.data ?? null;
|
||||
if (!ref) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user