Skip to content

Commit 99ec6fc

Browse files
Add llm buttons only if we render html - v2
1 parent 276d06c commit 99ec6fc

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/components/LLMButtons/index.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
import React from 'react';
2+
import { useLocation } from '@docusaurus/router';
23

34
import CopyForLLM from './CopyForLLM';
45
import styles from './styles.module.css';
56
import ViewAsMarkdown from './ViewAsMarkdown';
67

78
export default function LLMButtons() {
9+
const location = useLocation();
10+
11+
// Don't render LLMButtons if we're on a markdown view
12+
if (location.pathname.endsWith('.md')) {
13+
return null;
14+
}
15+
816
return (
917
<div className={styles.llmButtonsContainer}>
1018
<ViewAsMarkdown />

src/theme/DocItem/Content/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export default function DocItemContent({ children }) {
4949
'/platform',
5050
];
5151

52-
const shouldShowLLMButtons = allowedPaths.some((path) => location.pathname.startsWith(path) && !location.pathname.endsWith('.md'));
52+
const shouldShowLLMButtons = allowedPaths.some((path) => location.pathname.startsWith(path));
5353

5454
return (
5555
<div className={clsx(ThemeClassNames.docs.docMarkdown, 'markdown')}>

0 commit comments

Comments
 (0)