Skip to content

Commit 6883de1

Browse files
committed
Add robots.txt
1 parent 9af605b commit 6883de1

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/foxops/__main__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,17 @@ def create_app():
6767
name=f"ui-{frontend_dir}",
6868
)
6969

70+
robot_file = settings.frontend_dist_dir / "robots.txt"
71+
72+
if robot_file.exists():
73+
74+
@app.get("/robots.txt", include_in_schema=False)
75+
async def _serve_robots_txt():
76+
return FileResponse(robot_file)
77+
78+
else:
79+
logger.warning("The robots.txt file does not exist, skipping ...")
80+
7081
@app.get("/{full_path:path}", include_in_schema=False)
7182
async def _(full_path: str):
7283
"""Serve the frontend."""

ui/public/robots.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
User-agent: *
2+
Disallow: /

0 commit comments

Comments
 (0)