Skip to content

Add SEO description support for categories#2554

Merged
Freego1783 merged 2 commits intomainfrom
1620-category-seo-description
Mar 27, 2026
Merged

Add SEO description support for categories#2554
Freego1783 merged 2 commits intomainfrom
1620-category-seo-description

Conversation

@Aibono1225
Copy link
Copy Markdown
Member

@Aibono1225 Aibono1225 commented Mar 27, 2026

Relates to #1620

This pull request introduces support for an SEO description field for categories, allowing category pages to include a custom meta description for improved search engine optimization.

SEO Description Support for Categories:

  • Added a new seoDescription field to the category content model in tina/collection/category.tsx, including UI configuration for editors.
  • Updated the GraphQL query in tina/queries/queries.gql to fetch the seoDescription field for categories.

Metadata Generation Improvements:

  • Modified the generateMetadata function in app/[filename]/page.tsx to include the seoDescription as the page description meta tag if it is present. (app/[filename]/page.tsxL340-R352)
image

@Aibono1225
Copy link
Copy Markdown
Member Author

/deploy

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for an explicit SEO meta description on category pages, by introducing a seoDescription field in the TinaCMS category schema and surfacing it through the category GraphQL query into Next.js generateMetadata().

Changes:

  • Add seoDescription to the Tina “Category” collection schema (and regenerate tina-lock.json).
  • Extend categoryWithRulesQuery to fetch seoDescription.
  • Update category page metadata generation to use seoDescription when present.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
tina/tina-lock.json Regenerated Tina schema/GraphQL artifacts to include category seoDescription.
tina/queries/queries.gql Fetches seoDescription in categoryWithRulesQuery.
tina/collection/category.tsx Adds seoDescription field to the CategoryCategory template in the Tina collection config.
app/[filename]/page.tsx Uses category seoDescription (if present) as the page meta description.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/[filename]/page.tsx Outdated
Comment on lines 339 to 343
if (category?.data?.category && "title" in category.data.category) {
return {
title: `${category.data.category.title} | SSW.Rules`,
const categoryData = category.data.category as any;
const metadata: any = {
title: `${categoryData.title} | SSW.Rules`,
alternates: {
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In generateMetadata, the guard ("title" in category.data.category) doesn't actually narrow the Tina-generated union type (all category types have title), so the subsequent as any cast hides type errors and could break silently if getCategoryData ever returns a non-CategoryCategory. Prefer narrowing via __typename === "CategoryCategory" (or using the generated query types) and returning a properly typed Metadata object instead of any.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Fixed

@github-actions
Copy link
Copy Markdown
Contributor

PR Preview Deployed

Preview URL https://app-sswrules-staging-pr-2554.azurewebsites.net/rules
Slot Name pr-2554
Branch 1620-category-seo-description
Commit 1c076dd07b2cddeaf1cc9546615142e844d988f4

This preview will be automatically deleted when the PR is closed.

@Aibono1225 Aibono1225 changed the title Adds SEO description support for categories Add SEO description support for categories Mar 27, 2026
@Freego1783 Freego1783 merged commit e24c622 into main Mar 27, 2026
@Freego1783 Freego1783 deleted the 1620-category-seo-description branch March 27, 2026 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants