Skip to content
Last updated

OpenAPI extension: x-seo

Use x-seo to control the SEO meta tags rendered in the HTML <head> of an individual operation page: the page title, description, keywords, and the image used when the page link is shared.

x-seo replaces the legacy Redoc x-meta extension (and its nested seo object). The supported fields are identical: title, description, keywords, and image.

Location

Use the x-seo extension in an Operation Object.

Options

OptionTypeDescription
titlestringSets the page <title>, and the og:title and twitter:title meta tags for the operation page.
descriptionstringSets the <meta name="description">, and the og:description and twitter:description meta tags.
keywordsstringSets the <meta name="keywords"> tag. Provide a comma-separated list of keywords.
imagestringSets the og:image and twitter:image meta tags — the rich preview image shown when the page link is shared.

When a field is omitted, title falls back to the operation summary. description falls back to the operation description, or to the operation summary if the operation has no description. keywords and image have no fallback and are added only when set.

Examples

The following example sets all four SEO fields on the getMuseumHours operation:

paths:
  /museum-hours:
    get:
      summary: Get museum hours
      description: Opening times for the museum, including holiday hours.
      operationId: getMuseumHours
      x-seo:
        title: "Custom page title"
        description: "Detailed page description"
        keywords: documentation, operation, example
        image: 'https://example.com/image.png'
      responses: {}

Each field is resolved independently, so you can override only the fields you need. In the following example, title falls back to the operation summary and description falls back to the operation description, while keywords and image come from the extension:

paths:
  /museum-hours:
    get:
      summary: Get museum hours
      description: Opening times for the museum, including holiday hours.
      operationId: getMuseumHours
      x-seo:
        keywords: museum, hours, opening times
        image: 'https://example.com/museum.png'
      responses: {}

Resources