From a0f8360778b22ee77edada3014a114412d63c8d5 Mon Sep 17 00:00:00 2001 From: Jan Fajerski Date: Wed, 18 Mar 2026 16:48:01 +0000 Subject: [PATCH] feat: add "Report an issue" button to docs pages Adds a "Report an issue" button next to the existing "Edit this page" button on all documentation pages. The button opens a pre-filled GitHub issue in the same repo as the edit button (prometheus/docs for local docs, the upstream repo for repo-docs), with the page title and URL pre-populated. Closes #378 Co-Authored-By: Claude Sonnet 4.6 (1M context) Signed-off-by: Jan Fajerski --- .../docs/[...slug]/PrevNextEditButtons.tsx | 97 +++++++++++++------ 1 file changed, 67 insertions(+), 30 deletions(-) diff --git a/src/app/docs/[...slug]/PrevNextEditButtons.tsx b/src/app/docs/[...slug]/PrevNextEditButtons.tsx index fb3eb0007..317c0d1d0 100644 --- a/src/app/docs/[...slug]/PrevNextEditButtons.tsx +++ b/src/app/docs/[...slug]/PrevNextEditButtons.tsx @@ -1,8 +1,27 @@ import { Group, Box, Button, Text, Stack } from "@mantine/core"; import Link from "next/link"; -import { IconArrowRight, IconArrowLeft, IconPencil } from "@tabler/icons-react"; +import { + IconArrowRight, + IconArrowLeft, + IconPencil, + IconBug, +} from "@tabler/icons-react"; import { DocMetadata } from "@/docs-collection-types"; +function buildIssueUrl(currentPage: DocMetadata): string { + const repoBase = + currentPage.type === "local-doc" + ? "https://github.com/prometheus/docs" + : `https://github.com/${currentPage.owner}/${currentPage.repo}`; + + const title = encodeURIComponent(`docs: Issue with "${currentPage.title}"`); + const body = encodeURIComponent( + `**Page:** https://prometheus.io/docs/${currentPage.slug}/\n\n**Describe the issue:**\n\n` + ); + + return `${repoBase}/issues/new?title=${title}&body=${body}`; +} + export default function PrevNextEditButtons({ currentPage, }: { @@ -47,35 +66,53 @@ export default function PrevNextEditButtons({ )} - + + + + {currentPage.next && (