Skip to content

Fix whitespace in Algolia JSON generation - #11975

Open
MarkvanMents wants to merge 2 commits into
developmentfrom
MvM-BlankAlgoliaText
Open

MarkvanMents wants to merge 2 commits into
developmentfrom
MvM-BlankAlgoliaText

Conversation

@MarkvanMents

Copy link
Copy Markdown
Collaborator

Summary

  • Replaced trim ... " " with strings.TrimSpace for the text field to strip all Unicode whitespace including \r, \n, \t, and non-breaking spaces ( ) that were being uploaded as blank records to Algolia
  • Applied the same strings.TrimSpace fix to all h2–h6 heading fields, which previously retained trailing whitespace in heading values and the unique_hierarchy breadcrumb string

Test plan

  • Verify no "text":"\r" or whitespace-only text records appear in the generated Algolia JSON
  • Verify heading fields and unique_hierarchy values have no trailing whitespace

🤖 Generated with Claude Code

@MarkvanMents

Copy link
Copy Markdown
Collaborator Author

[TW-2843]

@MarkvanMents

Copy link
Copy Markdown
Collaborator Author

Tested and updated Algolia file to Algolia. Blank text entries are no longer there.
image
image

@OlufunkeMoronfolu
OlufunkeMoronfolu added this pull request to stack #11978 September 29, 2026 12:39
MarkvanMents and others added 2 commits September 29, 2026 14:46
After plainify strips HTML tags from heading elements, trailing \r, \n,
and other whitespace remained in the h2-h6 fields because htmlUnescape
alone does not trim. This caused dirty values in those fields and in the
unique_hierarchy breadcrumb string. Replaced htmlUnescape with
strings.TrimSpace (htmlUnescape ...) for all five heading levels.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant