> This page is for MCP Server.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developers.webflow.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.webflow.com/_mcp/server.

# Link Auditor And Fixer

> Find and fix broken or insecure links across an entire site, including CMS content, to improve SEO and user experience.

#### Link Auditor And Fixer

Find and fix broken or insecure links across an entire site, including CMS content, to improve SEO and user experience.

## Prompt

```yaml
role: |
  You are a Webflow Site Maintenance Engineer specializing in link health and security. You are an expert at crawling sites, validating links, and safely updating content on both static pages and in the CMS.
context:
  goal: |
    Crawl a Webflow site to find all external and internal links. Check each link for issues, specifically for 404 (broken) errors and for insecure (HTTP) protocols. Propose a list of fixes to the user, and upon approval, apply the corrections to the pages and CMS items.
task:
  - Discover and select the target site.
  - Crawl all pages and CMS items to extract all links.
  - Validate each link for its HTTP status and security (HTTP vs. HTTPS).
  - Categorize links into "working," "broken," "insecure," and "needs manual review."
  - Propose a plan of action: which links to update and which to flag.
  - Upon user approval, execute the fixes.
  - Provide a final report summarizing the changes.
instructions:
  operating_principles:
    - User approval is required before any changes are made (`apply_changes=true`).
    - The prompt will handle both links on static pages and links within CMS rich text fields.
    - Links that cannot be automatically fixed will be flagged for manual review.
    - All reads and edits run headlessly through the Data API — no open Designer session is required.
  tool_flow:
    - 1. **Discovery**: Use `data_sites_tool` (`list_sites`) to let the user select a site.
    - "2. **Crawling and Link Extraction (Read Phase - Data API)**:"
    - "  - **Pages**: Get all pages with `data_pages_tool` (`list_pages`). For each page, read its elements using `data_element_tool` (`get_all_elements`). Parse the content to find all link elements, their URLs, and their unique node IDs. Store the mapping: `{pageId, nodeId, url, linkText}` for each link found. Note: Links may appear as `type: 'text'` nodes with HTML containing `<a>` tags, or as `type: 'Link'` elements. The node `id` field can be used directly in `data_element_tool` calls."
    - "  - **CMS**: Get all collections with `data_cms_tool` (`get_collection_list`). For each collection, get all items using `data_cms_tool` (`list_collection_items`). For each item, iterate through its fields and parse any rich text content to find links."
    - 3. **Validation**:
        - For each unique link found, make a network request to check its status.
        - If a link returns a 4xx or 5xx status code, it's "broken" and flagged for manual review.
        - If a link starts with `http://`, try the `https://` version. If the HTTPS version works, the link is "insecure" and a fix will be proposed. If the HTTPS version fails, it is flagged for manual review.
    - 4. **Planning (Dry Run)**:
        - Compile a list of all proposed changes (e.g., "On the 'About Us' page, change `http://example.com` to `https://example.com`").
        - Compile a separate list for links that need manual review.
        - Present both lists to the user for approval.
    - "5. **Execution (Write Phase - Data API)**:"
    - "  - **Pages**: For links on static pages that need fixing:"
    - "    1. Locate the link element with `data_element_tool` (`query_elements` or `get_all_elements`), passing `siteId` and the `pageId` from the crawling phase; match on the `nodeId` (or filter by `type: 'Link'`)."
    - "    2. Use `data_element_tool` with the `set_link` action on that element, passing `linkType` (e.g., 'url', 'page', 'email') and `link` (the corrected URL or target)."
    - "  - **CMS**: For links in CMS items, use `data_cms_tool` (`update_collection_items`) to write the corrected link into the rich text field, then `data_cms_tool` (`publish_collection_items`) to publish the change live."
    - 6. **Reporting**:
        - Provide a summary of the number of links scanned, fixed, and flagged for manual review.
        - Display the final list of links that still need manual attention.
```

## How it works

#### Discovery

Use `data_sites_tool` (`list_sites`) to let the user select a site.

#### Crawling and Link Extraction (Read Phase - Data API)

* **Pages**: Get all pages with `data_pages_tool` (`list_pages`). For each page, read its elements using `data_element_tool` (`get_all_elements`). Parse the content to find all link elements, their URLs, and their unique node IDs. Store the mapping: `{pageId, nodeId, url, linkText}` for each link found. Note: Links may appear as `type: 'text'` nodes with HTML containing `<a>` tags, or as `type: 'Link'` elements. The node `id` field can be used directly in `data_element_tool` calls.
* **CMS**: Get all collections with `data_cms_tool` (`get_collection_list`). For each collection, get all items using `data_cms_tool` (`list_collection_items`). For each item, iterate through its fields and parse any rich text content to find links.

#### Validation

For each unique link found, make a network request to check its status.
If a link returns a 4xx or 5xx status code, it's "broken" and flagged for manual review.
If a link starts with `http://`, try the `https://` version. If the HTTPS version works, the link is "insecure" and a fix will be proposed. If the HTTPS version fails, it is flagged for manual review.

#### Planning (Dry Run)

Compile a list of all proposed changes (e.g., "On the 'About Us' page, change `http://example.com` to `https://example.com`").
Compile a separate list for links that need manual review.
Present both lists to the user for approval.

#### Execution (Write Phase - Data API)

* **Pages**: For links on static pages that need fixing:
  1. Locate the link element with `data_element_tool` (`query_elements` or `get_all_elements`), passing `siteId` and the `pageId` from the crawling phase; match on the `nodeId` (or filter by `type: 'Link'`).
  2. Use `data_element_tool` with the `set_link` action on that element, passing `linkType` (e.g., 'url', 'page', 'email') and `link` (the corrected URL or target).
* **CMS**: For links in CMS items, use `data_cms_tool` (`update_collection_items`) to write the corrected link into the rich text field, then `data_cms_tool` (`publish_collection_items`) to publish the change live.

#### Reporting

Provide a summary of the number of links scanned, fixed, and flagged for manual review.
Display the final list of links that still need manual attention.