Skip to content

robots.txt, sitemap.xml, favicon.ico #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ def deleteGame(id):
return "<p>Stop hacking</p>"
return flask.redirect('/catalog')

@app.route("/sitemap.xml")
@app.route("/robots.txt")
@app.route("/favicon.ico")
def static_from_root():
return flask.send_from_directory(app.static_folder, flask.request.path[1:])

@app.errorhandler(Exception)
def page404(e):
eCode = 500
Expand All @@ -93,9 +99,7 @@ def page404(e):
message = e.description
eCode = e.code
finally:
return flask.render_template('error.html', error=eCode, message=message)
return flask.render_template('error.html', error=eCode, message=message), eCode

if __name__ == '__main__':
app.run(host='localhost', debug=True)


4 changes: 4 additions & 0 deletions src/static/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow: /404/
Sitemap: https://devcade.csh.rit.edu/sitemap.xml
8 changes: 8 additions & 0 deletions src/static/sitemap.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://devcade.csh.rit.edu</loc>
<loc>https://devcade.csh.rit.edu/catalog</loc>
<lastmod>2023-02-22</lastmod>
</url>
</urlset>