Skip to content

Commit

Permalink
Merge pull request #1702 from starknet-io/bugfix/remove-seo-duplicate…
Browse files Browse the repository at this point in the history
…d-titles

Remove duplicated seo titles
  • Loading branch information
rafaelcruzazevedo authored Nov 23, 2023
2 parents 615aea6 + 389db20 commit 50fb5bd
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 4 deletions.
15 changes: 13 additions & 2 deletions workspaces/website/src/pages/posts/@category/index.page.server.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
/**
* Module dependencies.
*/

import { getCategories } from "@starknet-io/cms-data/src/categories";
import { getTopics } from "@starknet-io/cms-data/src/topics";
import { PageContextServer } from "src/renderer/types";
import { Props } from "src/pages/posts/PostsPage";
import { getDefaultPageContext } from "src/renderer/helpers";

/**
* Export `onBeforeRender` function.
*/

export async function onBeforeRender(pageContext: PageContextServer) {
const defaultPageContext = await getDefaultPageContext(pageContext);
const { locale } = defaultPageContext;
const { category: categorySlug } = pageContext.routeParams!;
const categories = await getCategories(locale, pageContext.context);
const category = categories.find((category) => category.slug === categorySlug);

const pageProps: Props = {
categories: await getCategories(locale, pageContext.context),
categories,
topics: await getTopics(locale, pageContext.context),
env: {
ALGOLIA_INDEX: import.meta.env.VITE_ALGOLIA_INDEX!,
Expand All @@ -27,7 +38,7 @@ export async function onBeforeRender(pageContext: PageContextServer) {
...defaultPageContext,
pageProps,
documentProps: {
title: "Starknet Blog",
title: `Starknet Blog - ${category?.name}`,
description: "Get the latest insights from across the Starknet ecosystem, learn what community members are building or take a deep dive into the math that powers Starknet.",
image: `${import.meta.env.VITE_SITE_URL}/assets/share/blog_landing.png`,
},
Expand Down
13 changes: 12 additions & 1 deletion workspaces/website/src/pages/roadmap/@slug/index.page.server.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { PageContextServer } from "src/renderer/types";
/**
* Module dependencies.
*/

import { DocumentProps, PageContextServer } from "src/renderer/types";
import { getDefaultPageContext } from "src/renderer/helpers";
import {
getRoadmapPostBySlug,
Expand All @@ -7,6 +11,10 @@ import {
import { RoadmapPostProps } from "./(components)/RoadmapPost";
import { getRoadmapSettings } from "@starknet-io/cms-data/src/settings/roadmap";

/**
* Export `onBeforeRender` function.
*/

export async function onBeforeRender(pageContext: PageContextServer) {
const defaultPageContext = await getDefaultPageContext(pageContext);
const { locale } = defaultPageContext;
Expand All @@ -30,6 +38,9 @@ export async function onBeforeRender(pageContext: PageContextServer) {
pageContext: {
...defaultPageContext,
pageProps,
documentProps: {
title: `Starknet Roadmap - ${roadmapPost.title}`,
} satisfies DocumentProps,
},
};
}
21 changes: 20 additions & 1 deletion workspaces/website/src/pages/roadmap/index.page.tsx
Original file line number Diff line number Diff line change
@@ -1 +1,20 @@
export { default as Page } from "src/pages/roadmap/(components)/RoadmapPage";
/**
* Module dependencies
*/

import { DocumentProps } from "src/renderer/types";

/**
* Export `Page` component
*/

export { default as Page } from "src/pages/roadmap/(components)/RoadmapPage";

/**
* Export `documentProps`.
*/

export const documentProps = {
title: "Starknet Roadmap",
description: "Explore the Starknet Roadmap for a comprehensive journey through our development milestones. Follow our progress as we continue to enhance performance, security, and usability, driving Starknet towards a new era of decentralized computing. Stay informed and join us on this exciting roadmap as we redefine the possibilities of blockchain technology."
} satisfies DocumentProps;

0 comments on commit 50fb5bd

Please sign in to comment.