torchbox / torchbox/django-pattern-library

Add sitemap / list of patterns endpoints

Open
#191 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
423
Forks
53
PR merge metrics
No merged PRs in 30d

Description

Is your proposal related to a problem?

There are two use cases we’ve run across where having a list of all the patterns within a project would be helpful:

  • For integration with Pa11y CI, to test all of the project’s patterns at once. It expects a sitemap, and has configuration to then ignore some of the entries.
  • For API usage with our new API rendering endpoint, to create a listing similarly to what the pattern library UI does
Describe the solution you'd like
  • One sitemap.xml URL with an XML sitemap
  • One custom API endpoint with the same nested patterns structure as in the UI
Describe alternatives you've considered

@jhancock532 shared with me his sitemap generator. I have created a custom API endpoint on my own.

Additional context

The logic to get the list / tree of patterns is here: https://github.com/torchbox/django-pattern-library/blob/main/pattern_library/utils.py#L82.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with pattern_library/utils.py around line 82, where the existing pattern-tree logic is linked. Trace how the UI and API rendering endpoint expose patterns, then add the two requested entry points: sitemap.xml in XML and a custom API response matching the UI's nested structure. Done means both URLs list all project patterns for the stated Pa11y CI and API use cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
api, backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.