Skip to content

feat(trustlab): add SEO support for organisations#1495

Merged
kilemensi merged 3 commits into
mainfrom
feat/trustlab-organisations-seo
Jul 1, 2026
Merged

feat(trustlab): add SEO support for organisations#1495
kilemensi merged 3 commits into
mainfrom
feat/trustlab-organisations-seo

Conversation

@kilemensi

@kilemensi kilemensi commented Jul 1, 2026

Copy link
Copy Markdown
Member

Description

Summary

  • Pathname hook: adds appendPathnameToCollection afterRead hook to Organisations, giving each doc a computed pathname (e.g. /organisations/some-org) — the foundation for correct canonical URLs and sitemap entries
  • SEO plugin: registers organisations with the Payload SEO plugin so editors get meta title/description/image fields in the admin UI; fixes generateTitle to fall back to doc.name (orgs don't have a title field) and generateURL to use doc.pathname
  • Sitemap: adds getOrganisationsEntries — only orgs with includeLink: true and linkType: "internal" are included, as those are the ones with a TrustLab detail page
  • Pagify: normalises the title field in pagifyOpportunities via doc.title || doc.name so organisation pages get a title for the <title> tag and canonical URL logic

Test plan

  • Organisation detail page renders with correct <title> and meta description
  • Canonical URL is /organisations/[slug], not just /[slug]
  • Payload admin SEO tab for an organisation shows a non-empty generated title (pulled from name)
  • /sitemap.xml includes organisations with linkType: "internal"
  • Organisations with linkType: "custom" or includeLink: false are absent from the sitemap

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Screenshots

SEO Title

S

Sitemap

  <url>
    <loc>http://localhost:3000/opportunities/organisations/dhamira-moja-cbo</loc>
    <lastmod>2026-07-01T06:31:43.212Z</lastmod>
  </url>
  <url>
    <loc>http://localhost:3000/opportunities/organisations/ajenda-kenya</loc>
    <lastmod>2026-07-01T06:35:34.716Z</lastmod>
  </url>
  <url>
    <loc>http://localhost:3000/opportunities/organisations/africa-youth-trust</loc>
    <lastmod>2026-07-01T06:34:08.921Z</lastmod>
  </url>
  <url>
    <loc>http://localhost:3000/opportunities/organisations/inuka-community-developers-network</loc>
    <lastmod>2026-07-01T06:30:45.043Z</lastmod>
  </url>
  <url>
    <loc>http://localhost:3000/opportunities/organisations/lamu-arts--theatre-alliance</loc>
    <lastmod>2026-06-30T14:10:10.826Z</lastmod>
  </url>

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas

kilemensi added 2 commits July 1, 2026 14:46
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
@kilemensi kilemensi self-assigned this Jul 1, 2026
@kilemensi kilemensi added bug Something isn't working enhancement New feature or request labels Jul 1, 2026
@kilemensi kilemensi added this to COMMONS Jul 1, 2026
@github-project-automation github-project-automation Bot moved this to 🚧 In Progress in COMMONS Jul 1, 2026
@kilemensi

This comment was marked as resolved.

@claude

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.
@kilemensi

This comment was marked as resolved.

@claude

This comment was marked as resolved.

@kilemensi kilemensi requested review from a team and kelvinkipruto July 1, 2026 12:24
@kilemensi kilemensi marked this pull request as ready for review July 1, 2026 12:24
@kilemensi kilemensi added this pull request to the merge queue Jul 1, 2026
Merged via the queue into main with commit c1ebbef Jul 1, 2026
11 checks passed
@kilemensi kilemensi deleted the feat/trustlab-organisations-seo branch July 1, 2026 12:47
@github-project-automation github-project-automation Bot moved this from 🚧 In Progress to ✅ Done in COMMONS Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

2 participants