Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cloudflare_site/public/robots.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Sitemap: https://fullsend.sh/docs/sitemap.xml

# Training crawlers — blocked site-wide
User-agent: ClaudeBot
Disallow: /
Expand Down
45 changes: 36 additions & 9 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,26 @@ import { defineConfig } from "vitepress";
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
import {
DOCS_URL_BASE,
globalSeoHead,
isIndexablePage,
isNonContentPath,
isSitemapUrl,
pageRobotsHead,
pageSeoHead,
} from "./seo";

const __dirname = path.dirname(fileURLToPath(import.meta.url));
const docsDir = path.resolve(__dirname, "..");

/** Non-content entry: template placeholder or repo-metadata (ALL-CAPS) name. */
function isNonContent(entry: string): boolean {
if (/^0000-.*-template/.test(entry)) return true;
const base = entry.replace(/\.md$/, "");
return /^[A-Z][A-Z0-9_-]*$/.test(base);
}

function getMarkdownFiles(dir: string, base: string): { text: string; link: string }[] {
const fullDir = path.resolve(docsDir, dir);
if (!fs.existsSync(fullDir)) return [];
const items: { text: string; link: string }[] = [];
for (const entry of fs.readdirSync(fullDir).sort()) {
const entryPath = path.resolve(fullDir, entry);
if (entry.endsWith(".md") && entry !== "README.md" && !isNonContent(entry)) {
if (entry.endsWith(".md") && entry !== "README.md" && !isNonContentPath(entry)) {
const slug = entry.replace(/\.md$/, "");
const content = fs.readFileSync(entryPath, "utf-8");
const fmTitleMatch = content.match(/^title:\s*["']?(.+?)["']?\s*$/m);
Expand All @@ -28,7 +30,7 @@ function getMarkdownFiles(dir: string, base: string): { text: string; link: stri
} else if (
fs.statSync(entryPath).isDirectory() &&
!entry.startsWith(".") &&
!isNonContent(entry)
!isNonContentPath(entry)
) {
const readme = path.resolve(entryPath, "README.md");
if (fs.existsSync(readme)) {
Expand Down Expand Up @@ -135,6 +137,12 @@ export default defineConfig({
description: "Autonomous SDLC agents for your codebase",

base: "/docs/",
// Required for SEO correctness, not cosmetic: Cloudflare Workers serves the
// extensionless URL with a 200 and 307-redirects the `.html` form. With
// cleanUrls the canonical/og:url/sitemap URLs match the 200-serving shape
// instead of pointing at redirecting `.html` URLs (search engines discard
// canonicals that redirect).
cleanUrls: true,
Comment thread
shairevivo marked this conversation as resolved.
Resolved

rewrites: {
"README.md": "index.md",
Expand All @@ -158,8 +166,27 @@ export default defineConfig({
href: "https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap",
},
],
// Site-wide SEO metadata (Open Graph type/site name/image + Twitter card).
...globalSeoHead,
],

// Emit sitemap.xml for the docs. The hostname carries the /docs/ base (and a
// trailing slash) because VitePress resolves base-less page paths against it.
sitemap: {
Comment thread
shairevivo marked this conversation as resolved.
Resolved
hostname: DOCS_URL_BASE,
transformItems: (items) => items.filter((item) => isSitemapUrl(item.url)),
},
Comment thread
qodo-code-review[bot] marked this conversation as resolved.
Resolved

// Per-page canonical + Open Graph tags derived from the resolved page data.
transformHead({ page, title, description, siteConfig }) {
const robotsHead = pageRobotsHead(page);
if (!isIndexablePage(page)) return robotsHead;
return [
...robotsHead,
...pageSeoHead({ page, title, description, cleanUrls: siteConfig.cleanUrls }),
];
},

srcExclude: ["**/agents/icons/**", "**/testing/**"],

ignoreDeadLinks: true,
Expand Down
161 changes: 161 additions & 0 deletions docs/.vitepress/seo.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
import { describe, expect, it } from "vitest";
import {
DOCS_URL_BASE,
canonicalUrl,
globalSeoHead,
isIndexablePage,
isNonContentPath,
isSitemapUrl,
pageOutputPath,
pageRobotsHead,
pageSeoHead,
} from "./seo";

describe("pageOutputPath", () => {
it("maps the root index to the empty (directory) path", () => {
expect(pageOutputPath("index.md")).toBe("");
expect(pageOutputPath("README.md")).toBe("");
});

it("maps a nested index/README to its directory", () => {
expect(pageOutputPath("agents/index.md")).toBe("agents/");
expect(pageOutputPath("guides/getting-started/README.md")).toBe("guides/getting-started/");
});

it("maps a content page to an .html path when cleanUrls is off", () => {
expect(pageOutputPath("agents/triage.md")).toBe("agents/triage.html");
expect(pageOutputPath("guides/user/jira-integration.md")).toBe(
"guides/user/jira-integration.html",
);
});

it("drops the extension entirely when cleanUrls is on", () => {
expect(pageOutputPath("agents/triage.md", true)).toBe("agents/triage");
expect(pageOutputPath("index.md", true)).toBe("");
});
});

describe("canonicalUrl", () => {
it("always includes the /docs/ base", () => {
// Regression guard: the docs are served under /docs/, so a base-less
// hostname (as in the original issue template) would drop that segment.
for (const page of ["index.md", "agents/triage.md", "guides/getting-started/README.md"]) {
expect(canonicalUrl(page).startsWith(DOCS_URL_BASE)).toBe(true);
}
});

it("resolves the redirecting root to its content destination", () => {
expect(canonicalUrl("index.md")).toBe("https://fullsend.sh/docs/guides/getting-started/");
});

it("resolves a directory index to a trailing-slash URL", () => {
expect(canonicalUrl("agents/index.md")).toBe("https://fullsend.sh/docs/agents/");
});

it("resolves a content page to its .html URL when clean URLs are off", () => {
expect(canonicalUrl("guides/user/jira-integration.md")).toBe(
"https://fullsend.sh/docs/guides/user/jira-integration.html",
);
});

it("resolves a content page to the URL shape served by Cloudflare", () => {
expect(canonicalUrl("guides/user/jira-integration.md", true)).toBe(
"https://fullsend.sh/docs/guides/user/jira-integration",
);
});
});

describe("pageSeoHead", () => {
const head = pageSeoHead({
page: "agents/triage.md",
title: "Triage Agent | Fullsend",
description: "How the triage agent works",
cleanUrls: true,
});

it("emits a canonical link and og:url with the full docs URL", () => {
const url = "https://fullsend.sh/docs/agents/triage";
expect(head).toContainEqual(["link", { rel: "canonical", href: url }]);
expect(head).toContainEqual(["meta", { property: "og:url", content: url }]);
});

it("emits page-specific og:title and og:description", () => {
expect(head).toContainEqual([
"meta",
{ property: "og:title", content: "Triage Agent | Fullsend" },
]);
expect(head).toContainEqual([
"meta",
{ property: "og:description", content: "How the triage agent works" },
]);
});
});

describe("isIndexablePage", () => {
it("excludes the 404 page from self-canonical / OG tags", () => {
expect(isIndexablePage("404.md")).toBe(false);
});

it("treats content pages as indexable", () => {
expect(isIndexablePage("index.md")).toBe(true);
expect(isIndexablePage("agents/triage.md")).toBe(true);
});

it("excludes template and repo-metadata pages from canonical metadata", () => {
expect(isIndexablePage("experiments/0000-experiment-template/index.md")).toBe(false);
expect(isIndexablePage("experiments/example/RESULTS.md")).toBe(false);
expect(isIndexablePage("experiments/example/skills/check/SKILL.md")).toBe(false);
});
});

describe("isNonContentPath", () => {
it("uses the same classification for source paths and clean URLs", () => {
expect(isNonContentPath("ADRs/0000-adr-template.md")).toBe(true);
expect(isNonContentPath("experiments/0000-experiment-template/")).toBe(true);
expect(isNonContentPath("experiments/example/RESULTS")).toBe(true);
expect(isNonContentPath("experiments/example/results")).toBe(false);
});

it("matches template names with suffixes, like the original isNonContent", () => {
// The predicate is unanchored (no trailing `$`) so a suffixed template such
// as `0000-foo-template-v2` classifies as non-content, matching the original
// sidebar-discovery regex rather than treating it as a content page.
expect(isNonContentPath("ADRs/0000-foo-template-v2.md")).toBe(true);
});
});

describe("isSitemapUrl", () => {
it("excludes the redirecting root and non-content URLs", () => {
expect(isSitemapUrl("")).toBe(false);
expect(isSitemapUrl("/")).toBe(false);
expect(isSitemapUrl("experiments/0000-experiment-template/")).toBe(false);
expect(isSitemapUrl("experiments/example/SKILL")).toBe(false);
});

it("keeps normal experiment pages in the public sitemap", () => {
expect(isSitemapUrl("experiments/0026-eval-statistical-significance/")).toBe(true);
});
});

describe("pageRobotsHead", () => {
it("marks the directly reachable 404 asset noindex", () => {
expect(pageRobotsHead("404.md")).toEqual([
["meta", { name: "robots", content: "noindex" }],
]);
expect(pageRobotsHead("agents/triage.md")).toEqual([]);
});
});

describe("globalSeoHead", () => {
it("declares site-wide Open Graph and Twitter card metadata", () => {
expect(globalSeoHead).toContainEqual(["meta", { property: "og:type", content: "website" }]);
expect(globalSeoHead).toContainEqual([
"meta",
{ property: "og:site_name", content: "Fullsend" },
]);
expect(globalSeoHead).toContainEqual([
"meta",
{ name: "twitter:card", content: "summary_large_image" },
]);
});
});
133 changes: 133 additions & 0 deletions docs/.vitepress/seo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
import type { HeadConfig } from "vitepress";

// SEO metadata helpers for the VitePress docs site.
//
// The docs are served under a base path — https://fullsend.sh/docs/ — so every
// absolute URL we emit (canonical, og:url, sitemap entries) must include that
// `/docs/` segment. VitePress 1.6.x builds sitemap entries as base-less relative
// paths and resolves them against `sitemap.hostname`, so the hostname itself must
// carry the base and a trailing slash. The same rule applies to URLs we resolve
// here, which is why DOCS_URL_BASE ends in a slash.

/** Public origin of the site. */
export const SITE_ORIGIN = "https://fullsend.sh";

/** Base path the docs are served under (matches `base` in config.ts). */
export const DOCS_BASE = "/docs/";

/**
* Absolute base for canonical/OG URLs and the sitemap `hostname`.
* The trailing slash is required for correct `new URL(relative, base)` resolution.
*/
export const DOCS_URL_BASE = `${SITE_ORIGIN}${DOCS_BASE}`;

/**
* Default social-share image (absolute URL). This is the square brand logo; a
* dedicated 1200×630 asset would render better on cards and is a good follow-up.
*/
export const OG_IMAGE = `${DOCS_URL_BASE}img/logo.png`;

/** Canonical destinations for pages that are redirects rather than content. */
const CANONICAL_REDIRECTS: Record<string, string> = {
"index.md": "guides/getting-started/",
};

/** Non-content path: template placeholder or repo-metadata (ALL-CAPS) name. */
export function isNonContentPath(pageOrUrl: string): boolean {
const pathOnly = pageOrUrl.split(/[?#]/, 1)[0];
return pathOnly
.split("/")
.filter(Boolean)
.some((segment) => {
const base = segment.replace(/\.(?:html|md)$/, "");
Comment thread
shairevivo marked this conversation as resolved.
Resolved
return /^0000-.*-template/.test(base) || /^[A-Z][A-Z0-9_-]*$/.test(base);
});
}

/**
* Convert a VitePress page path (the post-rewrite source path, e.g. "index.md",
* "agents/index.md", "guides/user/jira-integration.md") into the site-relative
* output path VitePress actually serves, mirroring its sitemap/link logic:
* - `index.md` / `README.md` → the containing directory ("" for the root)
* - other `*.md` → `*.html` (or the bare path when `cleanUrls` is enabled)
*
* The result is a base-less relative path, suitable for resolving against
* {@link DOCS_URL_BASE}.
*/
export function pageOutputPath(page: string, cleanUrls = false): string {
const asDir = page.replace(/(^|\/)(index|README)\.md$/, "$1");
if (asDir !== page) return asDir;
return page.replace(/\.md$/, cleanUrls ? "" : ".html");
}

/** Absolute canonical URL for a page, including the `/docs/` base. */
export function canonicalUrl(page: string, cleanUrls = false): string {
const outputPath = CANONICAL_REDIRECTS[page] ?? pageOutputPath(page, cleanUrls);
return new URL(outputPath, DOCS_URL_BASE).href;
}

export interface PageSeoInput {
/** Post-rewrite source path of the page (VitePress `TransformContext.page`). */
page: string;
/** Resolved page title (VitePress `TransformContext.title`). */
title: string;
/** Resolved page description (VitePress `TransformContext.description`). */
description: string;
cleanUrls?: boolean;
}

/**
* Per-page SEO head tags: a canonical link plus page-specific Open Graph tags.
* Twitter cards fall back to the `og:*` values, so no `twitter:title` /
* `twitter:description` duplication is needed.
*/
export function pageSeoHead({
page,
title,
description,
cleanUrls = false,
}: PageSeoInput): HeadConfig[] {
const url = canonicalUrl(page, cleanUrls);
return [
["link", { rel: "canonical", href: url }],
["meta", { property: "og:url", content: url }],
["meta", { property: "og:title", content: title }],
["meta", { property: "og:description", content: description }],
];
}

/**
* Whether a page should advertise a canonical / OG URL to crawlers.
* VitePress emits `404.html` as a directly reachable asset, while the deployed
* Worker's SPA fallback handles unknown paths separately. The 404 asset and
* non-content files must not advertise canonical content URLs. Tag omission by
* itself is not a `noindex` signal; {@link pageRobotsHead} supplies that for 404.
*/
export function isIndexablePage(page: string): boolean {
return page !== "404.md" && !isNonContentPath(page);
}

/** Robots metadata for pages that must not enter search indexes. */
export function pageRobotsHead(page: string): HeadConfig[] {
return page === "404.md" ? [["meta", { name: "robots", content: "noindex" }]] : [];
}

/**
* Whether a generated sitemap URL represents public content.
* The root is a meta-refresh redirect, so advertise its canonical destination
* instead. Normal experiment pages remain public; only their templates and
* repo-metadata pages are filtered with the same rule used by navigation.
*/
export function isSitemapUrl(url: string): boolean {
const normalized = url.replace(/^\/+|\/+$/g, "");
return normalized !== "" && !isNonContentPath(normalized);
}

/** Site-wide SEO head tags that are identical on every page. */
export const globalSeoHead: HeadConfig[] = [
["meta", { property: "og:type", content: "website" }],
["meta", { property: "og:site_name", content: "Fullsend" }],
["meta", { property: "og:image", content: OG_IMAGE }],
["meta", { name: "twitter:card", content: "summary_large_image" }],
["meta", { name: "twitter:image", content: OG_IMAGE }],
];
4 changes: 4 additions & 0 deletions docs/agents/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
description: Reference for the agents fullsend ships and how to register custom agents — resolved at runtime from the fullsend-ai/agents repository or your org and repo config.
---

# Agents

Reference documentation for the agents shipped by fullsend.
Expand Down
Loading
Loading