Skip to content

fix: improve sitemap content correctness in DefaultSitemapEntryLister#48

Merged
ruibaby merged 1 commit intohalo-dev:mainfrom
ruibaby:fix/sitemap-entry-lister
Apr 27, 2026
Merged

fix: improve sitemap content correctness in DefaultSitemapEntryLister#48
ruibaby merged 1 commit intohalo-dev:mainfrom
ruibaby:fix/sitemap-entry-lister

Conversation

@ruibaby
Copy link
Copy Markdown
Member

@ruibaby ruibaby commented Apr 27, 2026

Summary

Four correctness issues in DefaultSitemapEntryLister:

  1. Null permalink crash: post.getStatusOrDefault().getPermalink() can return null for posts/pages that haven't had their permalink computed yet. Emitting null in a Reactor stream causes an immediate NullPointerException, aborting the entire sitemap generation. Added .filter(StringUtils::isNotBlank) after each permalink mapping.

  2. Missing homepage: The site root / was never included in the sitemap. Added it as the first entry in urlsForListPages().

  3. Inconsistent SinglePage deletion check: Post uses !post.isDeleted() for deletion filtering, while SinglePage additionally had Objects.equals(false, singlePage.getSpec().getDeleted()) — a redundant check that duplicates what ExtensionOperator.isNotDeleted() already covers. Removed the redundant predicate to unify the logic.

  4. Stale TODO comment: Removed // TODO 优化系统其他路由获取 from production code.

Test plan

  • Verify /sitemap.xml includes the site homepage /
  • Confirm that a post with no permalink (e.g. draft being indexed) does not crash sitemap generation
  • Confirm published, non-deleted single pages appear in the sitemap

Made with Cursor

None

@f2c-ci-robot f2c-ci-robot Bot added the do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. label Apr 27, 2026
@f2c-ci-robot
Copy link
Copy Markdown

f2c-ci-robot Bot commented Apr 27, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign guqing for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@f2c-ci-robot f2c-ci-robot Bot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Apr 27, 2026
- Filter out null/blank permalinks in all list*Urls() methods to prevent
  IllegalArgumentException when UrlEntryMeta is constructed with a blank URL
- Add homepage '/' to urlsForListPages() so the root URL is always included
- Remove redundant Objects.equals(false, singlePage.getSpec().getDeleted())
  check in listSinglePageUrls(): ExtensionOperator.isNotDeleted() already
  covers this condition
- Remove stale TODO comment in urlsForListPages()

Made-with: Cursor
@ruibaby ruibaby force-pushed the fix/sitemap-entry-lister branch from 1179af4 to c5bff70 Compare April 27, 2026 08:54
@f2c-ci-robot f2c-ci-robot Bot added release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Apr 27, 2026
@ruibaby ruibaby merged commit a1d90a4 into halo-dev:main Apr 27, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note-none Denotes a PR that doesn't merit a release note.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant