django-pattern-library
django-pattern-library copied to clipboard
Add sitemap / list of patterns endpoints
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.