Skip to content

Commit 885e1a7

Browse files
lilyduCopilot
authored andcommitted
fix(docs-site): render <Language> blocks that list multiple languages
`Language` typed its prop as a single language and tested the path with `pathname.includes(`/${language}/`)`. Four call sites pass an array, which stringifies to "typescript,python", so the test looked for the path segment `/typescript,python/`, never matched, and the component returned null — silently dropping its children on every page. Accept `Language | readonly Language[]` and match if any listed language matches the current path. This restores content that was invisible sitewide, not just on the auth page: the two intro paragraphs on the Essentials landing page and the OAuth connection-name note both render again. Single-language gating is unchanged. Also add blank lines around the admonition inside that `<Language>` block so the markdown is parsed, matching the surrounding convention. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 9dc7434 commit 885e1a7

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

teams.md/src/components/Language.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@ import { useLocation } from '@docusaurus/router';
33
import { type Language } from '../constants/languages';
44

55
export type LanguageProps = {
6-
readonly language: Language;
6+
readonly language: Language | readonly Language[];
77
};
88

99
// Component for inserting language-specific content onto a page.
1010
export default function Language({ language, children }: PropsWithChildren<LanguageProps>) {
1111
const location = useLocation();
1212

13-
// Only render if current path matches language
14-
if (!location.pathname.includes(`/${language}/`)) {
13+
const languages = Array.isArray(language) ? language : [language as Language];
14+
15+
// Only render if current path matches one of the languages
16+
if (!languages.some((lang) => location.pathname.includes(`/${lang}/`))) {
1517
return null;
1618
}
1719

teams.md/src/pages/templates/in-depth-guides/user-authentication.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,11 @@ Make sure you use the same name you used when creating the OAuth connection in t
4848
:::
4949

5050
<Language language={['typescript', 'python']}>
51+
5152
:::note
5253
In many templates, `graph` is the default name of the OAuth connection, but you can register the connection under any name — it just has to match the OAuth connection configured on the Azure Bot.
5354
:::
55+
5456
</Language>
5557

5658
## Signing In

0 commit comments

Comments
 (0)