# Sitemap Lastmod Checker (`fabian_maume/sitemap-lastmod-checker`) Actor

Takes a website URL. Returns a per-sitemap report telling you, for every XML sitemap published by that site, whether it uses <lastmod> tags

- **URL**: https://apify.com/fabian_maume/sitemap-lastmod-checker.md
- **Developed by:** [Fabian Maume](https://apify.com/fabian_maume) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Sitemap lastmod checker

Takes a website URL. Returns a **per-sitemap report** telling you, for every XML sitemap published by that site, whether it uses `<lastmod>` tags and what HTTP status it served.

Useful for:

- **SEO audits**: Google uses `<lastmod>` as a hint for recrawl priority, so a sitemap without it is leaving a signal on the table.
- **RAG pipeline optimization**: if the site map supports lastmod you can use the [Website Content Crawler](https://apify.com/apify/website-content-crawler)'s onlyCrawlPagesModifiedSince parameter to crawl only new content

### How it works

1. Fetches `/robots.txt` on the input domain and extracts every `Sitemap:` directive.
2. Falls back to `/sitemap.xml` if robots.txt doesn't declare any (or returns 4xx).
3. For each sitemap URL, inspects the XML:
   - If it's a `<sitemapindex>`, enqueues each child sitemap (one level deep). The index itself is **not** written to the dataset — only leaf sitemaps are.
   - If it's a `<urlset>`, checks whether any `<url>` entry carries a non-empty `<lastmod>`.
4. **Waits for every sitemap to be checked**, then writes one dataset row per leaf sitemap in a single batch.

All requests go through a Cheerio-based HTTP crawler — no browser, no rendering. A typical check finishes in a few seconds and costs well below $0.01 in compute units.

### Input

| Field | Type | Required | Description |
|---|---|---|---|
| `websiteUrl` | string | yes | Homepage URL to check, e.g. `https://www.clay.com/`. |
| `maxSitemaps` | integer | no | Cap on sitemap files to fetch (default `20`, max `1000`). Prevents runaway cost on sites with thousands of sub-sitemaps. |
| `proxyConfiguration` | object | no | Apify Proxy config. Off by default — rarely needed for sitemap fetching. |

Example:

```json
{
    "websiteUrl": "https://www.clay.com/",
    "maxSitemaps": 20
}
```

### Dataset output

One row per leaf sitemap. Three fields:

| Field | Type | Description |
|---|---|---|
| `sitemapUrl` | string | The individual sitemap file that was inspected. |
| `httpStatusCode` | integer | null | HTTP response status. `null` if the request failed before a response arrived (DNS, TCP, timeout). |
| `supportsLastmod` | boolean | `true` if at least one `<url>` in that sitemap carried a non-empty `<lastmod>`. `false` otherwise (including for 4xx/5xx/network failures). |

Example dataset for `clay.com`:

```json
[
    {
        "sitemapUrl": "https://www.clay.com/guides/sitemap.xml",
        "httpStatusCode": 200,
        "supportsLastmod": true
    },
    {
        "sitemapUrl": "https://www.clay.com/sitemap.xml",
        "httpStatusCode": 200,
        "supportsLastmod": true
    }
]
```

A richer summary is also saved to the default key-value store as `OUTPUT`: total sitemaps reported, how many support lastmod, which sitemap-index files were traversed, and the full list of per-sitemap reports.

### Caveats

- Only follows sitemap-index files **one level deep**. Nested indices (rare) are inspected as plain sitemaps.
- Gzipped sitemaps (`.xml.gz`) are not decompressed. Most modern CMSs publish an uncompressed version too; if a site publishes only gzipped sitemaps, the entries won't be parsed and the row will show `supportsLastmod: false`.
- A sitemap containing `<url>` entries where only *some* carry `<lastmod>` is still reported as `supportsLastmod: true`. The actor treats the question as "does this sitemap use lastmod at all" — not "does every URL have one".
- `httpStatusCode` is the status of the sitemap fetch. A 404 means the sitemap URL was listed somewhere (robots.txt, a parent index, or the `/sitemap.xml` fallback) but doesn't exist.

### Cost

Pay-per-usage. A single run is one HTTP request to robots.txt plus one per sitemap file, so a typical site costs well under $0.01 in CU. Sites with hundreds of sub-sitemaps hit the `maxSitemaps` cap, which keeps worst-case cost bounded.

# Actor input Schema

## `websiteUrl` (type: `string`):

The homepage URL of the website to check. The Actor reads robots.txt to find sitemap URLs and falls back to /sitemap.xml. Sitemap-index files are followed one level deep.

## `maxSitemaps` (type: `integer`):

Hard limit on the number of individual sitemap files the Actor will fetch. Sitemap-index children count toward this limit.

## `proxyConfiguration` (type: `object`):

Optional proxy. Sitemap fetching rarely needs one, but turn it on if a site blocks datacenter IPs.

## Actor input object example

```json
{
  "websiteUrl": "https://www.clay.com/",
  "maxSitemaps": 20,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `dataset` (type: `string`):

Dataset with one row per leaf sitemap: URL, HTTP status, and whether <lastmod> is used.

## `summary` (type: `string`):

The OUTPUT record in the default key-value store — totals plus the full per-sitemap list.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "websiteUrl": "https://www.clay.com/",
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("fabian_maume/sitemap-lastmod-checker").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "websiteUrl": "https://www.clay.com/",
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("fabian_maume/sitemap-lastmod-checker").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "websiteUrl": "https://www.clay.com/",
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call fabian_maume/sitemap-lastmod-checker --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,fabian_maume/sitemap-lastmod-checker"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/iOVhAiSlDtg3VFBwq/builds/4SJBZUhqmz0Gm9hR1/openapi.json
