LearnNewsExamplesServices
Frontmatter
id7761
titleRefactor `resolveContentFileFromId` in `generateSeoFiles.mjs` for accurate content path resolution
stateClosed
labels
bugairefactoring
assigneestobiu
createdAtNov 12, 2025, 4:28 PM
updatedAtNov 12, 2025, 9:55 PM
githubUrlhttps://github.com/neomjs/neo/issues/7761
authortobiu
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtNov 12, 2025, 9:55 PM

Refactor resolveContentFileFromId in generateSeoFiles.mjs for accurate content path resolution

Closed v11.2.0 bugairefactoring
tobiu
tobiu commented on Nov 12, 2025, 4:28 PM

The resolveContentFileFromId function within buildScripts/generateSeoFiles.mjs is responsible for mapping ids from learn/tree.json to actual content files on disk. The current implementation includes a nestedCandidates logic that attempts to find README or index files within directories corresponding to tree.json ids.

This nestedCandidates logic appears to be an incorrect assumption or a "hallucination" as the tree.json ids are designed to provide direct paths to content files (e.g., benefits/Effort should map to learn/benefits/Effort.md). The current approach can lead to incorrect file resolution or unnecessary complexity.

Acceptance Criteria:

  1. Simplify resolveContentFileFromId: Remove the nestedCandidates logic from resolveContentFileFromId.
  2. Direct Path Resolution: The function should directly resolve content file paths by combining LEARN_DIR, the id (split into segments), and iterating through SUPPORTED_DOC_EXTENSIONS.
  3. Accurate Extension Handling: Ensure that the function correctly appends the appropriate file extension (e.g., .md, .json) to the id to find the corresponding content file.
  4. Validation: Verify that all ids in learn/tree.json correctly resolve to their respective content files after the refactoring.
tobiu added the bug label on Nov 12, 2025, 4:28 PM
tobiu added the ai label on Nov 12, 2025, 4:28 PM
tobiu added the refactoring label on Nov 12, 2025, 4:28 PM
tobiu assigned to @tobiu on Nov 12, 2025, 9:54 PM
tobiu referenced in commit 5a84395 - "Refactor resolveContentFileFromId in generateSeoFiles.mjs for accurate content path resolution #7761" on Nov 12, 2025, 9:55 PM
tobiu closed this issue on Nov 12, 2025, 9:55 PM