Skip to content

TWE-689: HTML Sitemap#428

Merged
damwaingames merged 14 commits into
mainfrom
BAU/TWE-698-site-map
Apr 30, 2026
Merged

TWE-689: HTML Sitemap#428
damwaingames merged 14 commits into
mainfrom
BAU/TWE-698-site-map

Conversation

@damwaingames

@damwaingames damwaingames commented Apr 21, 2026

Copy link
Copy Markdown
Collaborator

TWE-698 — HTML sitemap

Description of Changes Made

Adds a new SitemapPage Wagtail page type at /sitemap/ that lists all live, public pages on the site organised hierarchically by section, and links to it from the site footer.

  • tbx/sitemap/ — new Django app containing SitemapPage, a BasePage subclass that generates its content programmatically from the Wagtail page tree. No CMS-editable content fields — editors control only the slug and standard page metadata.
  • Query strategy — two DB queries per request: one for top-level sections, one for all descendants below the site root. Pages are grouped into section buckets and nested into a tree in Python, avoiding N+1 queries.
  • Exclusions mirror wagtail.contrib.sitemaps: .live().public() filters unpublished and password-protected pages; slug='incident' pages are excluded to match the project's per-page noindex convention.
  • Footer link — hardcoded in footer-links.html so editors cannot remove it via the CMS, and so it renders on fresh installs before a SitemapPage exists.
  • Slug enforcedclean() always sets slug = "sitemap" and raises a ValidationError if a second SitemapPage is created.
  • Styles — new _sitemap.scss component using existing design tokens.

Also fixes several pre-existing stylelint issues (_variables.scss, _grid.scss, _listing-image.scss, _pagination.scss) that were causing CI failures, and disables the scss/dollar-variable-no-missing-interpolation rule to resolve a conflict between stylelint and the CSS formatter.

How to Test

  1. Run ./manage.py migrate
  2. In the Wagtail admin, create a Sitemap page as a child of the home page
  3. Visit /sitemap/ — all live, public pages should be listed hierarchically
  4. Publish/unpublish a page in the CMS and reload /sitemap/ — the change should be reflected immediately
  5. Confirm /sitemap/ appears in the footer on every page
  6. Run the test suite: ./manage.py test tbx.sitemap

MR Checklist

  • Add a description of your pull request and instructions for the reviewer to verify your work.
  • If your pull request is for a specific ticket, link to it in the description.
  • Stay on point and keep it small so the merge request can be easily reviewed.
  • Tests and linting passes.

Unit tests

  • Added

Documentation

  • Not required

Browser testing

  • I have tested in the following browsers and environments (edit the list as required)
    • Latest version of Chrome on mac
    • Latest version of Firefox on mac
    • Latest version of Safari on mac

Data protection

  • Not relevant

Light and dark mode

  • I have tested the changes in both light and dark mode

Accessibility

  • Automated WCAG 2.1 tests pass
  • HTML validation passes
  • Manual WCAG 2.1 tests completed
  • I have tested in a screen reader
  • I have tested in high-contrast mode
  • Any animations removed for prefers-reduced-motion

Sustainability

  • Not required

Pattern library

  • The pattern library component for this template displays correctly, and does not break parent templates
  • The styleguide is updated if relevant
  • Changes are not relevant the pattern library

@damwaingames damwaingames requested a review from helenb April 21, 2026 10:31

@helenb helenb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @damwaingames this is looking great. I've got a few points for you to look through. I've reviewed this from a front-end perspective so it would be good to get a back-end review too.

Comment thread tbx/project_styleguide/templates/patterns/pages/sitemap/sitemap_page.html Outdated
Comment thread tbx/project_styleguide/templates/patterns/navigation/components/footer-links.html Outdated
Comment thread tbx/static_src/sass/components/_pagination.scss
Comment thread .stylelintrc.js
Comment thread .gitignore
@helenb

helenb commented Apr 23, 2026

Copy link
Copy Markdown
Member

@damwaingames thanks for the fixes - happy to approve this from a FE perspective - just one minor query remaining. I'll leave it to @nickmoreton to add the approve stamp when he's looked at the back-end.

@nickmoreton nickmoreton left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HI @damwaingames Did you consider using a view class for the site map page? It feels like having to create a page in the admin with a slug that gets overridden could be avoided. Unless I'm missing something?
I'm assuming that the page will always be in place and shouldn't/couldn't be removed, unless we decide to remove it.

@damwaingames

Copy link
Copy Markdown
Collaborator Author

HI @damwaingames Did you consider using a view class for the site map page? It feels like having to create a page in the admin with a slug that gets overridden could be avoided. Unless I'm missing something? I'm assuming that the page will always be in place and shouldn't/couldn't be removed, unless we decide to remove it.

Yes, but this means that the editors can still control the meta data.

Comment thread tbx/sitemap/models.py Outdated
Comment thread tbx/sitemap/models.py Outdated
Comment thread tbx/sitemap/models.py Outdated
Comment thread tbx/sitemap/models.py
Comment thread tbx/sitemap/models.py Outdated
@helenb

helenb commented Apr 30, 2026

Copy link
Copy Markdown
Member

@damwaingames can you address @zerolab's feedback and then update staging before this gets deployed to production?

Comment thread tbx/navigation/templatetags/navigation_tags.py Outdated
Comment thread tbx/sitemap/models.py Outdated
damwaingames and others added 2 commits April 30, 2026 09:42
@damwaingames damwaingames merged commit 903970c into main Apr 30, 2026
4 checks passed
@damwaingames damwaingames deleted the BAU/TWE-698-site-map branch April 30, 2026 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants