diff --git a/src/core/llms-txt.ts b/src/core/llms-txt.ts index 7b6fbe4..71aa300 100644 --- a/src/core/llms-txt.ts +++ b/src/core/llms-txt.ts @@ -13,7 +13,8 @@ function collectMarkdownFiles(dir: string, base: string = dir): MarkdownFile[] { const fullPath = join(dir, entry); const stat = statSync(fullPath); - if (stat.isDirectory() && !entry.startsWith('.') && entry !== 'node_modules') { + const SKIP_DIRS = new Set(['node_modules', 'public', 'dist', '.next', '.nuxt', '.output', '.open-next', 'coverage', '__tests__', '__mocks__']); + if (stat.isDirectory() && !entry.startsWith('.') && !SKIP_DIRS.has(entry)) { files.push(...collectMarkdownFiles(fullPath, base)); } else if (stat.isFile() && (extname(entry) === '.md' || extname(entry) === '.mdx')) { const content = readFileSync(fullPath, 'utf-8'); diff --git a/src/core/sitemap.ts b/src/core/sitemap.ts index 1d867a2..f85474e 100644 --- a/src/core/sitemap.ts +++ b/src/core/sitemap.ts @@ -12,7 +12,8 @@ function collectUrls(dir: string, config: ResolvedAeoConfig, base: string = dir) const fullPath = join(dir, entry); const stat = statSync(fullPath); - if (stat.isDirectory() && !entry.startsWith('.') && entry !== 'node_modules') { + const SKIP_DIRS = new Set(['node_modules', 'public', 'dist', '.next', '.nuxt', '.output', '.open-next', 'coverage', '__tests__', '__mocks__']); + if (stat.isDirectory() && !entry.startsWith('.') && !SKIP_DIRS.has(entry)) { urls.push(...collectUrls(fullPath, config, base)); } else if (stat.isFile() && (extname(entry) === '.md' || extname(entry) === '.mdx' || extname(entry) === '.html')) { const relativePath = relative(base, fullPath); diff --git a/src/plugins/next.ts b/src/plugins/next.ts index f003b2a..3a20604 100644 --- a/src/plugins/next.ts +++ b/src/plugins/next.ts @@ -99,9 +99,11 @@ export function withAeo(nextConfig: NextAeoConfig = {}): Record { } } - // Resolve contentDir: prefer user-specified, then src/, then project root + // Resolve contentDir: prefer user-specified, then known content dirs, then src/ + // Never fall back to project root — it causes recursive crawling of public/, .next/, etc. const contentDir = aeoOptions.contentDir - || (existsSync(join(projectRoot, 'src')) ? join(projectRoot, 'src') : projectRoot); + || [join(projectRoot, 'content'), join(projectRoot, 'docs'), join(projectRoot, 'src')].find(d => existsSync(d)) + || join(projectRoot, 'content'); const resolvedConfig = resolveConfig({ ...aeoOptions, @@ -247,7 +249,8 @@ export async function postBuild(config: AeoConfig = {}): Promise { } const contentDir = config.contentDir - || (existsSync(join(projectRoot, 'src')) ? join(projectRoot, 'src') : projectRoot); + || [join(projectRoot, 'content'), join(projectRoot, 'docs'), join(projectRoot, 'src')].find(d => existsSync(d)) + || join(projectRoot, 'content'); const resolvedConfig = resolveConfig({ ...config, diff --git a/website/public/og.png b/website/public/og.png new file mode 100644 index 0000000..fc450c6 Binary files /dev/null and b/website/public/og.png differ