Skip to content

fix(ssg-md): avoid generating "# undefined" in llms.txt and warn when title is missing#3207

Merged
SoonIter merged 4 commits intomainfrom
syt-vibe-kanban/23ae-plugin-llms-llms
Mar 9, 2026
Merged

fix(ssg-md): avoid generating "# undefined" in llms.txt and warn when title is missing#3207
SoonIter merged 4 commits intomainfrom
syt-vibe-kanban/23ae-plugin-llms-llms

Conversation

@SoonIter
Copy link
Copy Markdown
Member

@SoonIter SoonIter commented Mar 9, 2026

Summary

defineConfig({
  // title
})
# undefined

> undefined

Related Issue

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

AI Summary

When title is not configured in rspress.config.ts, both @rspress/plugin-llms and the core llms: true feature generate # undefined as the heading in llms.txt. This is because the template literal `# ${title}` directly interpolates undefined.

Changes

  • packages/plugin-llms/src/llmsTxt.ts: When title is undefined, skip the heading instead of rendering # undefined, and emit a logger.warn to remind users to configure title.
  • packages/core/src/node/ssg-md/llms/llmsTxt.ts: Same fix for the core llms: true code path.
  • When summary is empty (no title), the final llmsTxt output starts directly from the section content with leading whitespace trimmed.

Why

Generating # undefined in llms.txt is confusing and unhelpful. Instead of silently dropping the title, we warn users so they can fix their config, while still producing valid output.

This PR was written using Vibe Kanban


SoonIter added 2 commits March 9, 2026 14:48
…figured

When config.title is undefined, the template literal `# ${title}` produces
"# undefined" in the generated llms.txt. Now both plugin-llms and core
llms:true skip the title heading when title is undefined.
Add a logger.warn message in both plugin-llms and core llms:true paths
to remind users to set `title` in rspress.config.ts when it is missing.
Copilot AI review requested due to automatic review settings March 9, 2026 07:30
@SoonIter SoonIter changed the title plugin-llms 和 llms: true 中,当 title 为 undefined 的时候,生成的 llms.txt 均会生成 (vibe-kanban) fix: avoid generating "# undefined" in llms.txt and warn when title is missing Mar 9, 2026
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Mar 9, 2026

Deploying rspress-v2 with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6496007
Status: ✅  Deploy successful!
Preview URL: https://679d3c65.rspress-v2.pages.dev
Branch Preview URL: https://syt-vibe-kanban-23ae-plugin.rspress-v2.pages.dev

View logs

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR prevents generating llms.txt headings like # undefined when title is missing, and emits a warning to guide users toward setting title in rspress.config.ts.

Changes:

  • Add a warning when title is falsy during llms.txt generation.
  • Make the heading (summary) optional and avoid outputting # undefined.
  • Adjust final output formatting to avoid a leading blank line when there is no heading.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
packages/plugin-llms/src/llmsTxt.ts Warn on missing title; omit heading and adjust formatting when title is absent.
packages/core/src/node/ssg-md/llms/llmsTxt.ts Same missing-title handling and formatting adjustments in core SSG generator.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 9, 2026

Rsdoctor Bundle Diff Analysis

Found 3 projects in monorepo, 0 projects with changes.

📊 Quick Summary
Project Total Size Change
node 12.2 MB 0
web 16.1 MB 0
node_md 1.5 MB 0

Generated by Rsdoctor GitHub Action

@SoonIter SoonIter changed the title fix: avoid generating "# undefined" in llms.txt and warn when title is missing fix(ssg-md): avoid generating "# undefined" in llms.txt and warn when title is missing Mar 9, 2026
SoonIter added 2 commits March 9, 2026 16:08
- Only warn about missing title when onTitleGenerate is not provided,
  since custom hooks may intentionally handle undefined titles.
- Avoid trailing newline when summary exists but lines array is empty.
@SoonIter SoonIter requested a review from Timeless0911 March 9, 2026 08:31
@SoonIter SoonIter enabled auto-merge (squash) March 9, 2026 08:36
@SoonIter SoonIter merged commit 46700d4 into main Mar 9, 2026
5 checks passed
@SoonIter SoonIter deleted the syt-vibe-kanban/23ae-plugin-llms-llms branch March 9, 2026 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants