feat(trustlab): add SEO support for organisations#1495
Merged
Conversation
Adds the appendPathnameToCollection afterRead hook to the Organisations collection, giving each org doc a computed pathname field (e.g. /organisations/some-org). This is the foundation for correct canonical URLs, SEO preview links, and sitemap entries. payload-types.ts regenerated to reflect the updated collection shape.
- Add "organisations" to the Payload SEO plugin so editors get the meta title/description/image fields in the admin UI - Fix generateTitle to fall back to doc.name (orgs use name, not title) - Fix generateURL to use doc.pathname when available (relies on the pathname hook added in the previous commit) - Fix generateLabel in nestedDocsPlugin to handle docs with name only - Normalise title in pagifyOpportunities via doc.title || doc.name so organisation pages get a page title for canonical URL and <title> tag - Add getOrganisationsEntries to sitemap generation; only orgs with includeLink and linkType "internal" have a TrustLab detail page
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Extracts generateURL into a named function with correct destructured
signature ({ doc }), strips the leading slash from pathname to pair with
site.url's trailing slash, and falls back to slug when pathname is absent.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
kelvinkipruto
approved these changes
Jul 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Summary
appendPathnameToCollectionafterReadhook toOrganisations, giving each doc a computedpathname(e.g./organisations/some-org) — the foundation for correct canonical URLs and sitemap entriesorganisationswith the Payload SEO plugin so editors get meta title/description/image fields in the admin UI; fixesgenerateTitleto fall back todoc.name(orgs don't have atitlefield) andgenerateURLto usedoc.pathnamegetOrganisationsEntries— only orgs withincludeLink: trueandlinkType: "internal"are included, as those are the ones with a TrustLab detail pagetitlefield inpagifyOpportunitiesviadoc.title || doc.nameso organisation pages get a title for the<title>tag and canonical URL logicTest plan
<title>and meta description/organisations/[slug], not just/[slug]name)/sitemap.xmlincludes organisations withlinkType: "internal"linkType: "custom"orincludeLink: falseare absent from the sitemapType of change
Screenshots
SEO Title
Sitemap
Checklist: