Skip to main content

🗺️ image_sitemap


PyPI version Python versions Downloads

Image & Website Sitemap Generator - SEO Tool for Better Visibility

Sitemap Images is a Python tool that generates a specialized XML sitemap file, allowing you to submit image URLs to search engines like Google, Bing, and Yahoo. This tool helps improve image search visibility, driving more traffic to your website and increasing engagement. To ensure search engines can discover your sitemap, simply add the following line to your robots.txt file:

Sitemap: https://example.com/sitemap-images.xml

By including image links in your sitemap and referencing it in your robots.txt file, you can enhance your website's SEO and make it easier for users to find your content.

Google image sitemaps standard description - Click.

📦 Features

  • Supports both website and image sitemap generation
  • Easy integration with existing Python projects
  • Helps improve visibility in search engine results
  • Boosts image search performance
  • Subdomain filtering with exclusion support
  • Configurable crawling depth and query parameters

✍️ Examples

  1. Set website page and crawling depth, run script
    import asyncio
    
    from image_sitemap import Sitemap
    from image_sitemap.instruments.config import Config
      
    images_config = Config(
        max_depth=3,
        accept_subdomains=True,
        excluded_subdomains={"blog", "api", "staging"},  # Exclude specific subdomains
        is_query_enabled=False,
        file_name="sitemap_images.xml",
        header={
           "User-Agent": "ImageSitemap Crawler",
           "Accept": "text/html",
        },
    )
    sitemap_config = Config(
        max_depth=3,
        accept_subdomains=True,
        excluded_subdomains={"blog", "api", "staging"},  # Exclude specific subdomains
        is_query_enabled=False,
        file_name="sitemap.xml",
        header={
           "User-Agent": "ImageSitemap Crawler",
           "Accept": "text/html",
        },
    )
    
    asyncio.run(Sitemap(config=images_config).run_images_sitemap(url="https://rucaptcha.com/"))
    asyncio.run(Sitemap(config=sitemap_config).run_sitemap(url="https://rucaptcha.com/"))
    
  2. Get sitemap images data in file
    <?xml version="1.0" encoding="UTF-8"?>
    <urlset
        xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
        <url>
            <loc>https://rucaptcha.com/proxy/residential-proxies</loc>
            <image:image>
                <image:loc>https://rucaptcha.com/dist/web/assets/rotating-residential-proxies-NEVfEVLW.svg</image:loc>
            </image:image>
        </url>
    </urlset>
    
    Or just sitemap file
    <?xml version="1.0" encoding="UTF-8"?>
    <urlset
       xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
       <url>
           <loc>https://rucaptcha.com/</loc>
       </url>
       <url>
           <loc>https://rucaptcha.com/h</loc>
       </url>
    </urlset>
    

🔧 Configuration Options

The Config class provides various options to customize sitemap generation:

Subdomain Control

  • accept_subdomains (bool): Enable/disable subdomain crawling (default: True)
  • excluded_subdomains (Set[str]): Set of subdomain names to exclude from parsing (default: set())
# Example: Include all subdomains except blog and api
config = Config(
    accept_subdomains=True,
    excluded_subdomains={"blog", "api", "staging", "dev"}
)

# This will include:
# - example.com
# - www.example.com  
# - shop.example.com
# But exclude:
# - blog.example.com
# - api.example.com
# - staging.example.com
# - dev.example.com

Other Options

  • max_depth (int): Maximum crawling depth (default: 1)
  • is_query_enabled (bool): Include URLs with query parameters (default: True)
  • file_name (str): Output sitemap filename (default: "sitemap_images.xml")
  • exclude_file_links (bool): Filter out file links from sitemap (default: True)
  • header (dict): Custom HTTP headers for requests

You can check examples file here - Click.

Metadata

Release files for image-sitemap 2.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for image-sitemap 2.1.0
File Size Uploaded
image_sitemap-2.1.0.tar.gz 18.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for image-sitemap 2.1.0
File Interpreter ABI Platform
image_sitemap-2.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 35.9 kB

Release files / image_sitemap-2.1.0.tar.gz

Download URL image_sitemap-2.1.0.tar.gz
Size 18.0 kB
Tags Source
SHA-256 checksum
How to use checksums
5c268ab9a4f0dc0a1d897918282c1b3b7c2a2fd805b5aefb4829688e891f79dd
BLAKE2b-256 checksum
How to use checksums
24ccf039a28f9f64a8248c90025a3532e2a1b4b83665f776b9dd3954c8f6bd97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.4

Release files / image_sitemap-2.1.0-py3-none-any.whl

Download URL image_sitemap-2.1.0-py3-none-any.whl
Size 17.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b4cdbd9626496c9e8ed07f0a1349b3d8ac33246cfc989978acb3f88807e14254
BLAKE2b-256 checksum
How to use checksums
21596ed761d7b77479ed0dc4ac81b36600a3e811385bfcd2701ccdd90f280c2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.4

Release history Release notifications | RSS feed

This release

2.1.0 This release

2 release files

2.0.0

2 release files

1.1.0

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page