Adds an llms.txt at the site root with a static product preamble so LLMs can answer "what is Paseo" without following any links, plus a curated index of docs, alternatives, and the 38 agent pages. Doc pages now expose Copy/View as markdown buttons and a raw .md version at <path>.md following the llms.txt convention. Also skips the canonical-host redirect for localhost so the dev server stops punting every request to production.
44 lines
1.4 KiB
TypeScript
44 lines
1.4 KiB
TypeScript
import { Check, Copy, FileText } from "lucide-react";
|
|
import { useCallback, useEffect, useState } from "react";
|
|
|
|
interface DocsMarkdownActionsProps {
|
|
content: string;
|
|
markdownHref: string;
|
|
}
|
|
|
|
export function DocsMarkdownActions({ content, markdownHref }: DocsMarkdownActionsProps) {
|
|
const [copied, setCopied] = useState(false);
|
|
|
|
useEffect(() => {
|
|
if (!copied) return;
|
|
const id = setTimeout(() => setCopied(false), 1500);
|
|
return () => clearTimeout(id);
|
|
}, [copied]);
|
|
|
|
const onCopy = useCallback(() => {
|
|
navigator.clipboard.writeText(content).then(() => setCopied(true));
|
|
}, [content]);
|
|
|
|
return (
|
|
<div className="not-prose flex flex-wrap items-center gap-2 mb-8">
|
|
<button
|
|
type="button"
|
|
onClick={onCopy}
|
|
className="inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors"
|
|
>
|
|
{copied ? <Check size={14} /> : <Copy size={14} />}
|
|
{copied ? "Copied" : "Copy as markdown"}
|
|
</button>
|
|
<a
|
|
href={markdownHref}
|
|
target="_blank"
|
|
rel="noreferrer"
|
|
className="inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors"
|
|
>
|
|
<FileText size={14} />
|
|
View as markdown
|
|
</a>
|
|
</div>
|
|
);
|
|
}
|