torchbox / torchbox/django-pattern-library
Add sitemap / list of patterns endpoints
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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