# How to add a sitemap in Bubble

- Tool: Bubble
- Difficulty: Beginner
- Time required: 15-20 min
- Compatibility: Starter plan+ (backend workflows required)
- Last updated: March 2026

## TL;DR

Bubble does not generate sitemaps automatically, but you can create one using a backend API workflow that outputs XML, or by manually hosting a sitemap.xml file via an API endpoint. This tutorial covers generating a sitemap that includes both static pages and dynamic content pages, then submitting it to Google Search Console.

## Overview: Adding a Sitemap to Your Bubble App

A sitemap tells search engines which pages exist on your site and how often they change. Bubble does not generate sitemaps automatically, so you need to build one. This tutorial shows you how to create a dynamic sitemap that includes your static pages and database-driven dynamic pages.

## Before you start

- A Bubble app deployed to a custom domain (recommended for SEO)
- Backend workflows enabled (Starter plan or above)
- A Google Search Console account
- Basic understanding of XML structure

## Step-by-step guide

### 1. Create a backend API workflow that returns XML

Go to the Workflow tab → Backend workflows. Create a new API workflow called sitemap. Check Expose as a public API workflow. In the workflow, the goal is to return XML content. Since Bubble backend workflows return JSON by default, you will need a workaround: create a page that generates the XML and is accessible at a known URL, or use the Return data from API action to return the sitemap content as text.

**Expected result:** A backend API workflow accessible at a public URL that can return sitemap content.

### 2. Build the sitemap XML content

Your sitemap needs to follow the standard XML sitemap protocol. List all your static pages (home, about, pricing, contact, blog) with their full URLs. For dynamic pages (blog posts, product pages), use a Do a Search to find all published records and generate a URL for each one using their slug. Format each entry with the loc, lastmod, changefreq, and priority tags.

```
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://yourdomain.com</loc>
    <changefreq>weekly</changefreq>
    <priority>1.0</priority>
  </url>
  <url>
    <loc>https://yourdomain.com/blog</loc>
    <changefreq>daily</changefreq>
    <priority>0.8</priority>
  </url>
  <url>
    <loc>https://yourdomain.com/blog-post/my-first-post</loc>
    <lastmod>2026-03-15</lastmod>
    <changefreq>monthly</changefreq>
    <priority>0.6</priority>
  </url>
</urlset>
```

> Pro tip: For a simpler approach, create a dedicated Bubble page that generates the sitemap XML using an HTML element with the XML content, then point Google Search Console to that page URL.

**Expected result:** A complete sitemap XML with all static and dynamic page URLs.

### 3. Create a sitemap page as an alternative approach

A simpler method: create a Bubble page called sitemap-xml. Add a single HTML element that contains your sitemap XML. For dynamic content, use Bubble's dynamic expressions to generate URL entries. Build the XML string using a Repeating Group's items or Text element with dynamic data. Access this page at https://yourdomain.com/sitemap-xml.

**Expected result:** A Bubble page at /sitemap-xml that displays your sitemap content.

### 4. Submit the sitemap to Google Search Console

Go to search.google.com/search-console. Select your property (domain). Navigate to Sitemaps in the left sidebar. Enter your sitemap URL (e.g., https://yourdomain.com/sitemap-xml or the API endpoint URL). Click Submit. Google will fetch and process your sitemap. Check back in a few days to see the indexing status and any errors.

**Expected result:** Google Search Console accepts your sitemap and begins crawling your pages.

### 5. Add the sitemap reference to robots.txt

Go to Settings in Bubble. In the SEO / metatags section, find the robots.txt field. Add a line: Sitemap: https://yourdomain.com/sitemap-xml. This tells all search engine crawlers where to find your sitemap without requiring manual submission to each engine.

**Expected result:** Your robots.txt file references the sitemap URL for automatic discovery by search engines.

## Complete code example

File: `Workflow summary`

```text
SITEMAP SETUP SUMMARY
======================

APPROACH 1: Sitemap Page
  Page: sitemap-xml
  HTML Element content (dynamic):
    <?xml version="1.0" encoding="UTF-8"?>
    <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
      <url><loc>https://domain.com</loc><priority>1.0</priority></url>
      <url><loc>https://domain.com/blog</loc><priority>0.8</priority></url>
      [For each published Post:]
        <url>
          <loc>https://domain.com/blog-post/[Post's slug]</loc>
          <lastmod>[Post's Modified Date:formatted as YYYY-MM-DD]</lastmod>
          <priority>0.6</priority>
        </url>
    </urlset>

APPROACH 2: Backend API Workflow
  Workflow: sitemap (exposed as public API)
  Return data: XML string generated with dynamic content
  URL: https://app.bubbleapps.io/api/1.1/wf/sitemap

ROBOTS.TXT (Settings → SEO/metatags):
  User-agent: *
  Allow: /
  Sitemap: https://yourdomain.com/sitemap-xml

GOOGLE SEARCH CONSOLE:
  1. Add property for your domain
  2. Verify ownership
  3. Sitemaps → Add sitemap URL
  4. Monitor indexing status

STATIC PAGES TO INCLUDE:
  / (home) — priority 1.0
  /about — priority 0.7
  /pricing — priority 0.8
  /blog — priority 0.8
  /contact — priority 0.5

DYNAMIC PAGES TO INCLUDE:
  /blog-post/[slug] — Search all Posts where published=yes
  /product/[slug] — Search all Products where active=yes
```

## Common mistakes

- **Forgetting to include dynamic pages in the sitemap** — Dynamic pages (blog posts, products) are often the most valuable for SEO but get missed if you only list static pages Fix: Query your database for all published dynamic content and generate a URL entry for each record
- **Not updating the sitemap when new content is published** — A stale sitemap does not help search engines discover new pages Fix: Use dynamic expressions so the sitemap page automatically includes new records when they are published
- **Using incorrect URL formats in the sitemap** — URLs must be fully qualified (https://domain.com/path) and match exactly what users see in the browser Fix: Always use full absolute URLs starting with https:// and use your custom domain, not the bubbleapps.io subdomain

## Best practices

- Include both static pages and dynamic content pages in your sitemap
- Use your custom domain in sitemap URLs, not the bubbleapps.io subdomain
- Add lastmod dates for content that changes, using the record's Modified Date
- Reference your sitemap in robots.txt for automatic crawler discovery
- Resubmit the sitemap in Google Search Console after major content additions
- Keep sitemaps under 50,000 URLs and 50MB — split into multiple sitemaps if needed

## Frequently asked questions

### Does Bubble generate a sitemap automatically?

No. Bubble does not have built-in sitemap generation. You need to create one manually using a page, API workflow, or a plugin.

### Do I need a custom domain for SEO?

A custom domain is strongly recommended. Google treats bubbleapps.io subdomains as part of a shared domain, which can limit your SEO authority.

### How often does Google re-crawl my sitemap?

Google crawls sitemaps on its own schedule, typically every few days to weeks. You can request re-crawling in Google Search Console after major updates.

### Can I have multiple sitemaps?

Yes. Use a sitemap index file that references multiple sitemaps. This is useful if you have separate sitemaps for blog posts, products, and static pages.

### Will a sitemap guarantee my pages get indexed?

No. A sitemap is a suggestion to search engines, not a guarantee. Pages still need quality content, proper meta tags, and no indexing blocks to be indexed.

### Can RapidDev help with comprehensive SEO for my Bubble app?

Yes. RapidDev can help with technical SEO including sitemaps, structured data, meta tags, page speed optimization, and content strategy for Bubble apps.

---

Source: https://www.rapidevelopers.com/bubble-tutorial/add-a-sitemap-on-bubble
© RapidDev — https://www.rapidevelopers.com/bubble-tutorial/add-a-sitemap-on-bubble
