Python Script for SEO Sitemap/Robots.txt Generation

🤖AI Prompt Script

Act as an SEO Specialist and Python Developer. I need a script to generate basic sitemap and robots.txt files for a small static website.

Write a Python script using standard libraries (no external packages).

The script must perform the following:

Create a standard robots.txt file that disallows the /admin/ directory and allows access to all other pages for all user agents.

Generate a simple XML sitemap (sitemap.xml) containing a list of URLs provided by the user (e.g., [INSERT 3 SAMPLE URLS]).

Include a placeholder for the <lastmod> tag in the sitemap.

Explain the one key difference in how search engines treat rules in robots.txt vs. entries in sitemap.xml.

Posted Jun 11, 2026, 10:30 PM UTC

11
Loading comments…