Skip to content

Commit 6a773a3

Browse files
committed
fix: make "Copy for LLMs" button work with query parameters in the URL
1 parent b596b88 commit 6a773a3

File tree

1 file changed

+5
-1
lines changed
  • apify-docs-theme/src/theme/LLMButtons

1 file changed

+5
-1
lines changed

apify-docs-theme/src/theme/LLMButtons/index.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ const DROPDOWN_OPTIONS = [
5555
];
5656

5757
const getPrompt = (currentUrl) => `Read from ${currentUrl} so I can ask questions about it.`;
58-
const getMarkdownUrl = (currentUrl) => `${currentUrl}.md`;
58+
const getMarkdownUrl = (currentUrl) => {
59+
const url = new URL(currentUrl);
60+
url.pathname = `${url.pathname.replace(/\/$/, '')}.md`;
61+
return url.toString();
62+
};
5963

6064
const onOpenInChatGPTClick = () => {
6165
if (window.analytics) {

0 commit comments

Comments
 (0)