simonw / datasette-sitemap

Generate sitemap.xml for Datasette sites
Apache License 2.0
2 stars 0 forks source link

Plugin hook so other plugins can contribute lines to the file #5

Closed simonw closed 2 years ago

simonw commented 2 years ago

Inspired by:

@hookspec
def block_robots_extra_lines(datasette, request):
    "A list of extra lines to be added to /robots.txt"
simonw commented 2 years ago

Design:

@hookspec
def sitemap_extra_paths(datasette, request):
    "A list of extra paths to be added to /sitemap.xml"

Will return a list of paths (starting with /).

Since the paths don't need to be resolved to full URLs I'm not sure if the request parameter is needed or not. I'm going to include it just in case someone wants to do something really weird like dynamically change the sitemap based on the search engine user agent - and for consistency with the design of block_robots_extra_lines.