Skip to content

Commit

Permalink
add cms-driven metadata to pages (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsladerman authored Dec 20, 2024
1 parent 765e50e commit 2af0973
Show file tree
Hide file tree
Showing 14 changed files with 143 additions and 38 deletions.
5 changes: 2 additions & 3 deletions pages/contact.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ export const getStaticProps = async () => {
ctaText: page?.cta_text,
ctaUrl: page?.cta_url,
form: page?.form,
metaTitle: 'Contact us',
metaDescription:
'Plural offers support to teams of all sizes. We’re here to support our developers through our docs, Discord channel, or Twitter.',
metaTitle: page?.meta_title,
metaDescription: page?.meta_description,
footerVariant: FooterVariant.kitchenSink,
})
}
2 changes: 2 additions & 0 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ export const getStaticProps = async () => {

return propsWithGlobalSettings(
{
metaTitle: page?.meta_title,
metaDescription: page?.meta_description,
pageQueryData: page,
footerVariant: FooterVariant.kitchenSink,
errors: combineErrors([error]),
Expand Down
3 changes: 2 additions & 1 deletion pages/legal/[legal].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ export const getStaticProps: GetStaticProps<CommunityPageProps> = async (

return propsWithGlobalSettings({
footerVariant: FooterVariant.kitchenSink,
metaTitle: page.title,
metaTitle: page.meta_title,
metaDescription: page.meta_description,
title: page.title,
subtitle: page.subtitle,
markdoc,
Expand Down
4 changes: 2 additions & 2 deletions pages/pricing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ export const getStaticProps = async () => {
}

return propsWithGlobalSettings({
metaTitle: 'Pricing',
metaDescription: 'Flexible plans for every stage of your business',
metaTitle: data.pricing_page?.meta_title,
metaDescription: data.pricing_page?.meta_description,
enterprisePlan,
proPlan,
footerVariant: FooterVariant.kitchenSink,
Expand Down
5 changes: 2 additions & 3 deletions pages/product.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,8 @@ export const getStaticProps = async () => {

return propsWithGlobalSettings(
{
metaTitle: 'Our platform',
metaDescription:
'A single platform to manage your entire Kubernetes fleet',
metaTitle: page?.meta_title,
metaDescription: page?.meta_description,
pageQueryData: page,
footerVariant: FooterVariant.kitchenSink,
errors: combineErrors([error]),
Expand Down
4 changes: 2 additions & 2 deletions pages/products/[product].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ export const getStaticProps = async (context) => {
}

return propsWithGlobalSettings({
metaTitle: product?.dropdown_title ?? '',
metaDescription: product?.dropdown_description ?? '',
metaTitle: product?.meta_title,
metaDescription: product?.meta_description,
footerVariant: FooterVariant.kitchenSink,
productInfo: product,
})
Expand Down
4 changes: 2 additions & 2 deletions pages/resources/[resource].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ export const getStaticProps = async (context) => {
}

return propsWithGlobalSettings({
metaTitle: resourceInfo?.dropdown_title ?? '',
metaDescription: '',
metaTitle: resourceInfo.meta_title,
metaDescription: resourceInfo.meta_description,
footerVariant: FooterVariant.kitchenSink,
resourceInfo,
})
Expand Down
4 changes: 2 additions & 2 deletions pages/solutions/[solution].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ export const getStaticProps = async (context: GetStaticPropsContext) => {

return propsWithGlobalSettings({
solution,
metaTitle: 'Plural Solution',
metaDescription: solution.dropdown_title || null,
metaTitle: solution.meta_title,
metaDescription: solution.meta_description,
footerVariant: FooterVariant.kitchenSink,
errors: combineErrors([solutionError]),
})
Expand Down
134 changes: 111 additions & 23 deletions src/generated/graphqlDirectus.ts

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/graph/directus/pageData/pricing.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ fragment PricingPage on pricing_page {
enterprise_plan {
...PricingPlan
}
meta_title
meta_description
}

fragment PricingPlan on pricing_plans {
Expand Down
2 changes: 2 additions & 0 deletions src/graph/directus/pageData/product.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ fragment ProductPage on product_pages {
...CustomComponent
}
}
meta_title
meta_description
}

fragment ProductPageTiny on product_pages {
Expand Down
2 changes: 2 additions & 0 deletions src/graph/directus/pageData/resources.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ fragment ResourcePage on resource_pages {
...CustomComponent
}
}
meta_title
meta_description
}

fragment ResourcePageTiny on resource_pages {
Expand Down
2 changes: 2 additions & 0 deletions src/graph/directus/pageData/solution.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ fragment SolutionPage on solutions_pages {
...CustomComponent
}
}
meta_title
meta_description
}

fragment SolutionPageTiny on solutions_pages {
Expand Down
8 changes: 8 additions & 0 deletions src/graph/directus/topLevelPages.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ fragment MarkdownPage on markdown_pages {
title
subtitle
content
meta_title
meta_description
}

fragment PageLegal on page_legal {
Expand All @@ -30,6 +32,8 @@ fragment PageHomepage on page_homepage {
...CustomComponent
}
}
meta_title
meta_description
}

fragment PlatformOverviewPage on platform_overview_page {
Expand All @@ -49,6 +53,8 @@ fragment PlatformOverviewPage on platform_overview_page {
image {
...ImageFile
}
meta_title
meta_description
}

fragment ContactPage on contact_sales {
Expand All @@ -59,6 +65,8 @@ fragment ContactPage on contact_sales {
form {
...Form
}
meta_title
meta_description
}

query PageLegal {
Expand Down

0 comments on commit 2af0973

Please sign in to comment.