diff --git a/quartz.layout.ts b/quartz.layout.ts index 0bed580f7..f46fad883 100644 --- a/quartz.layout.ts +++ b/quartz.layout.ts @@ -27,10 +27,7 @@ export const defaultContentPageLayout: PageLayout = { components: [ { Component: Component.ArticleTitle(), grow: true, align: "start" }, { - Component: Component.ConditionalRender({ - component: Component.CopyPageMarkdown(), - condition: (page) => page.fileData.slug !== "index", - }), + Component: Component.CopyPageMarkdown(), align: "start", }, ], diff --git a/quartz/components/CopyPageMarkdown.tsx b/quartz/components/CopyPageMarkdown.tsx index d6e1eae49..30fa73516 100644 --- a/quartz/components/CopyPageMarkdown.tsx +++ b/quartz/components/CopyPageMarkdown.tsx @@ -6,10 +6,13 @@ import { classNames } from "../util/lang" const CopyPageMarkdown: QuartzComponent = ({ fileData, displayClass }: QuartzComponentProps) => { const slug = fileData.slug + const isHomePage = slug === "index" + const buttonText = isHomePage ? "Copy all blog content" : "Copy page" + const ariaLabel = isHomePage ? "Copy all blog content" : "Copy page as Markdown" return (
- - +
diff --git a/quartz/components/scripts/copypage.inline.ts b/quartz/components/scripts/copypage.inline.ts index 506fb45d5..7e57b8650 100644 --- a/quartz/components/scripts/copypage.inline.ts +++ b/quartz/components/scripts/copypage.inline.ts @@ -5,7 +5,8 @@ const svgCheck = async function copyPageMarkdown(slug: string): Promise { try { - const llmsUrl = `/${slug}/llms.txt` + // Use full blog content for home page, individual page content otherwise + const llmsUrl = slug === "index" ? `/llms-full.txt` : `/${slug}/llms.txt` const response = await fetch(llmsUrl) if (!response.ok) { console.error("Failed to fetch markdown:", response.statusText) @@ -21,7 +22,9 @@ async function copyPageMarkdown(slug: string): Promise { } function getLlmsUrl(slug: string): string { - return `${window.location.origin}/${slug}/llms.txt` + // Use full blog content for home page, individual page content otherwise + const path = slug === "index" ? `/llms-full.txt` : `/${slug}/llms.txt` + return `${window.location.origin}${path}` } document.addEventListener("nav", () => { @@ -72,12 +75,15 @@ document.addEventListener("nav", () => { e.stopPropagation() const success = await copyPageMarkdown(slug) if (success && textSpan && iconSpan) { + const isHomePage = slug === "index" + const originalText = isHomePage ? "Copy all blog content" : "Copy page" + textSpan.textContent = "Copied!" iconSpan.outerHTML = svgCheck dropdown!.classList.remove("show") setTimeout(() => { - textSpan.textContent = "Copy page" + textSpan.textContent = originalText const newIcon = mainButton!.querySelector("svg:first-child") if (newIcon) { newIcon.outerHTML = svgCopy