# Fill In Missing SEO Titles and Descriptions with AI

> Source: https://agilitycms.com/docs/editors/ai-recipe-seo-metadata

Pages without a meta description, or with a page title that just repeats the menu name, are easy to miss and slow to fix one at a time. An AI assistant connected to Agility can find them, draft a title and description for each from the page's own content, and save the drafts to Staging for you to review.

If you haven't connected an assistant yet, start with [Using AI Assistants with Agility CMS](/docs/editors/using-ai-assistants-with-agility).

## Goal

Every page (and, if your site uses them, every SEO-enabled content item such as blog posts) has a useful **Page Title** and **Meta Description**, drafted by the assistant and approved by you.

## Where SEO fields live

There are two places, and it helps to know which one your site uses:

- **Pages** have built-in SEO fields on the SEO tab of the page editor: **Page Title**, **Meta Description**, **Meta Keywords** and more. See [Managing SEO for Editors](/docs/editors/manage-seo). Page titles are limited to 128 characters.
- **Content items** that become their own pages, such as blog posts or products, often have SEO fields your developers added to the content model, with names like `Meta Description` or `SEO Title`. The assistant can look at the content model to find them.

If you're not sure which applies, ask the assistant: "Which SEO fields do pages and blog posts have in this instance?"

## Step 1: Find what's missing (read-only)

Paste this, replacing the parts in square brackets:

```text
In the [instance name] Agility instance, [en-us] locale, find pages on the
[website] sitemap that have an empty Meta Description or a Page Title that is
the same as the menu text. Don't change anything yet.

Show me a table with: page name, URL path, current Page Title,
current Meta Description.
```

For content items, use this instead:

```text
In the [instance name] Agility instance, [en-us] locale, look at the
[Blog Posts] content list. Tell me which field is used for the SEO description,
then list every item where that field is empty. Don't change anything yet.
```

## Step 2: Draft, then save

Once the list looks right, ask for drafts:

```text
For each item in that list, draft:
- a Page Title of 60 characters or fewer that includes the main topic
- a Meta Description of 150 to 160 characters, written from the page's own
  content, in plain language, with no claims that aren't on the page

Show me the drafts as a table with character counts. Don't save yet.
```

Read the table. Ask for changes to individual rows ("Make number 4 less salesy", "Mention pricing on the pricing page"). When you're happy:

```text
Save those drafts. Only change the SEO title and description fields.
Keep every other field and every component on the page exactly as it is.
Skip any item that already has unpublished changes in Staging.
Then give me a list of what you changed with links to open each one in Agility.
```

## What the assistant does

In plain words, behind the scenes:

1. **Finds your instance and locale** (`get_available_instances`, `get_locales`).
2. **Reads the page tree** for the sitemap you named (`get_sitemap`), then **opens each page** to read its SEO fields and the content of its components (`get_page`).
3. For content items, **reads the content model** to find the SEO fields (`get_content_model_details`) and **reads the items** in the list (`get_content_items`, `get_content_item`).
4. **Writes the drafts itself.** The text comes from the AI model you're using, based on what it read.
5. **Saves** the new values: pages with `save_page`, content items with `save_content_items`. Saves land in **Staging**. Nothing is published.

## Review the result in Agility

1. Open each changed item from the links the assistant gives you, or find it with [Content Search](/docs/editors/finding-your-content).
2. For a page, open the SEO options (the target icon below **Properties** in the right-hand sidebar) and read the Page Title and Meta Description. For a content item, check the SEO fields on the item.
3. Check the components and other fields are unchanged. If anything else changed, open [Version History](/docs/editors/versioning) (the clock icon in the right-hand panel) to compare with the previous version side by side, and revert if you need to.
4. Use **Preview** to see the page as it will appear.
5. Publish, or request approval if your workflow requires it. See [Previewing, Publishing, and Content States](/docs/editors/preview-and-publishing).

If the [SEO Analysis app](/docs/apps/seo-analysis) is installed on your instance, its sidebar panel scores the meta description length and title width for each page, which is a quick second check.

## Variations

- **Rewrite weak ones, not just empty ones.** "Also include descriptions shorter than 70 characters."
- **Use a focus keyphrase.** "For each page, suggest one focus keyphrase and make sure it appears in the title and description."
- **Match your house style.** Paste two descriptions you like and say "Write in this style."
- **One section at a time.** "Only pages under /products."
- **Another locale.** Repeat in `fr-ca` and say "Write in Canadian French."
- **Run it fully automated.** If your organization has set SEO fields up for autonomous publishing, a scheduled job or agent can run this recipe on its own: find empty fields, draft values, check each one (length, no other field changed), publish the items that pass with `publish_content` or `publish_page`, and send you a list of any that didn't pass. See [Choose how much the assistant does](/docs/editors/using-ai-assistants-with-agility#choose-how-much-the-assistant-does).

## Pitfalls

- **Descriptions that promise things the page doesn't say.** Ask the assistant to only use facts from the page, and check the drafts.
- **Overwriting good existing values.** Be explicit that only empty or weak fields should change.
- **Changing more than SEO.** When the assistant saves a page or item, it sends the whole thing back. Always include "keep every other field and component exactly as it is", and check after saving.
- **Editing someone else's draft.** If a page already has unpublished changes, your save becomes part of that Staging version. Skip those items, or check with the person working on them.
- **Folders and link pages.** Folder pages and links to other URLs don't have content of their own to summarize. Ask the assistant to skip them.

## Related articles

- [Using AI Assistants with Agility CMS](/docs/editors/using-ai-assistants-with-agility)
- [Audit Your Content with AI](/docs/editors/ai-recipe-content-audit)
- [Managing SEO for Editors](/docs/editors/manage-seo)
- [SEO Analysis app](/docs/apps/seo-analysis)
