From ae83fd2adc2c36ce5a1e5c9101b00c769ed8c2e2 Mon Sep 17 00:00:00 2001 From: BestCodes <106822363+The-Best-Codes@users.noreply.github.com> Date: Fri, 27 Mar 2026 14:45:34 -0500 Subject: [PATCH] fix "View as Markdown" feature not working (#8160) Signed-off-by: The-Best-Codes <106822363+The-Best-Codes@users.noreply.github.com> --- documentation/src/theme/DocItem/Layout/index.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/documentation/src/theme/DocItem/Layout/index.tsx b/documentation/src/theme/DocItem/Layout/index.tsx index b78ec980..812aa376 100644 --- a/documentation/src/theme/DocItem/Layout/index.tsx +++ b/documentation/src/theme/DocItem/Layout/index.tsx @@ -359,6 +359,7 @@ function CopyPageButton(): ReactNode { // New wrapper component that adds dropdown menu to copy button function PageActionsMenu(): ReactNode { + const {metadata} = useDoc(); const [dropdownOpen, setDropdownOpen] = useState(false); const dropdownRef = useRef(null); @@ -391,11 +392,8 @@ function PageActionsMenu(): ReactNode { }, [dropdownOpen]); const handleViewMarkdown = () => { - const currentPath = window.location.pathname; - const mdPath = currentPath.endsWith('/') - ? `${currentPath.slice(0, -1)}.md` - : `${currentPath}.md`; - window.open(mdPath, '_blank'); + const source = metadata?.source?.replace('@site/', '') || ''; + window.open(`https://raw.githubusercontent.com/block/goose/refs/heads/main/documentation/${source}`, '_blank'); setDropdownOpen(false); };