Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3 - include non-dynamic pages in SEO fetching #697

Merged
merged 2 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion studio/lib/queries/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const SLUG_QUERY = groq`
`;

export const SEO_SLUG_QUERY = groq`
*[_type == "pageBuilder" && slug.current == $slug][0]{
*[defined(seo) && slug.current == $slug][0]{
Copy link
Contributor

Choose a reason for hiding this comment

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

how would this transfer for documents where we don't have or want seo? I'm assuming the default SEO would then be the fallback? Say for Legal documents

Copy link
Contributor Author

@mathiazom mathiazom Sep 23, 2024

Choose a reason for hiding this comment

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

This PR does not change that behavior. Here we only say that any page with a field seo should use that data for SEO metadata, otherwise use default SEO. Opting out of SEO for a page, like legal documents, is not currently possible.

Copy link
Contributor

Choose a reason for hiding this comment

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

perff

"title": seo.seoTitle,
"description": seo.seoDescription,
"imageUrl": seo.seoImage.asset->url
Expand Down
2 changes: 2 additions & 0 deletions studio/schemas/documents/specialPages/customerCasesPage.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { defineType } from "sanity";

import { title } from "studio/schemas/fields/text";
import seo from "studio/schemas/objects/seo";
import { titleSlug } from "studio/schemas/schemaTypes/slug";

export const customerCasesPageID = "customerCasesPage";
Expand All @@ -17,6 +18,7 @@ const customerCasesPage = defineType({
"Enter the primary title that will be displayed at the top of the customer cases page. This is what users will see when they visit the page.",
},
titleSlug,
seo,
],
preview: {
select: {
Expand Down