Skip to content

fix(blog): encode XML special characters in RSS feed title and descri…#198

Merged
scosman merged 2 commits intoscosman:mainfrom
stickerdaniel:fix/rss-xml-encoding
Jun 22, 2025
Merged

fix(blog): encode XML special characters in RSS feed title and descri…#198
scosman merged 2 commits intoscosman:mainfrom
stickerdaniel:fix/rss-xml-encoding

Conversation

@stickerdaniel
Copy link
Copy Markdown
Contributor

@stickerdaniel stickerdaniel commented Jun 20, 2025

…ption for proper formatting

Fixed character encoding for blog, RSS XML was failing for special characters in blog title/description.

Fixed search results showing & instead of & in titles. The issue was that the search index used the raw HTML content when building, but we should use textContent

Blog issue fixed:
CleanShot 2025-06-20 at 15 05 37@2x

Search issue fixed:
CleanShot 2025-06-20 at 15 01 30@2x

Summary by CodeRabbit

  • Bug Fixes
    • Improved extraction of page titles for greater accuracy.
    • Enhanced RSS feed reliability by properly encoding special characters in blog titles and descriptions.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 20, 2025

Walkthrough

The updates modify how page titles are extracted from HTML and enhance XML entity encoding in the blog RSS feed. The first change switches from using innerHTML to textContent for title extraction. The second ensures that blog title and description fields are properly XML-encoded in the generated RSS feed.

Changes

File(s) Change Summary
src/lib/build_index.ts Switched page title extraction from innerHTML to textContent for improved text retrieval.
src/routes/(marketing)/blog/rss.xml/+server.ts Added XML entity encoding for blog title and description fields in RSS feed generation.

Poem

In the warren of code, a title’s new quest,
From innerHTML to textContent—now it’s the best!
RSS feeds sparkle, encoded just right,
Special characters hop safely through the night.
🐇✨
Another day’s work, neat and complete,
Bugs and oddities now face defeat!

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

npm error Exit handler never called!
npm error This is an error with npm itself. Please report this error at:
npm error https://github.com/npm/cli/issues
npm error A complete log of this run can be found in: /.npm/_logs/2025-06-20T19_07_20_509Z-debug-0.log

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
src/lib/build_index.ts (1)

39-41: Switch to textContent for robust title extraction.

Using textContent instead of innerHTML correctly strips out HTML tags and prevents markup from polluting your search index. Consider adding a .trim() to remove any incidental whitespace around the title.

src/routes/(marketing)/blog/rss.xml/+server.ts (1)

20-23: Escape blogInfo fields in RSS feed with encodeXML.

Applying encodeXML to <title> and <description> ensures special characters are properly escaped in the XML output. Nice work! Optionally, you could migrate this manual string‐concatenation into a small XML-builder utility to improve maintainability.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2831c5a and dd2e6c9.

📒 Files selected for processing (2)
  • src/lib/build_index.ts (1 hunks)
  • src/routes/(marketing)/blog/rss.xml/+server.ts (1 hunks)

@scosman
Copy link
Copy Markdown
Owner

scosman commented Jun 22, 2025

Thanks!

@scosman scosman merged commit e8e8ed2 into scosman:main Jun 22, 2025
4 checks passed
adryserage pushed a commit to adryserage/SvelteKitSaasStarter that referenced this pull request Dec 23, 2025
fix(blog): encode XML special characters in RSS feed title and descri…
adryserage pushed a commit to adryserage/SvelteKitSaasStarter that referenced this pull request Mar 5, 2026
fix(blog): encode XML special characters in RSS feed title and descri…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants