Skip to content

Commit

Permalink
5 add sitemapxml (#14)
Browse files Browse the repository at this point in the history
* Add sitemap.xml
  • Loading branch information
nbodony authored Sep 3, 2024
1 parent f92d2dd commit 9e5e857
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ def croissant_dataset(dataset):
def citation_dataset(dataset):
return render_template("citation.cff", dataset=dataset)

@app.get("/sitemap.xml")
def sitemap():
data = load_data()
rendered_sitemap = flask.render_template("sitemap.xml", data=data)
return flask.Response(rendered_sitemap, mimetype='application/xml')

@app.get("/license/<dataset>")
def license_dataset(dataset):
Expand Down
11 changes: 11 additions & 0 deletions templates/sitemap.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://data.aifarms.org/</loc>
</url>
{% for slug in data.keys() %}
<url>
<loc>https://data.aifarms.org/view/{{ slug }}</loc>
</url>
{% endfor %}
</urlset>

0 comments on commit 9e5e857

Please sign in to comment.