Skip to content

Commit

Permalink
Merge pull request #1464 from starknet-io/dev
Browse files Browse the repository at this point in the history
Merge dev into production
  • Loading branch information
rafaelcruzazevedo authored Sep 27, 2023
2 parents f61f3af + fa44d03 commit 9097710
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 4 deletions.
23 changes: 23 additions & 0 deletions workspaces/cms-config/src/collections/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,29 @@ export const pagesCollectionConfig = {
label: "Show title",
widget: "boolean"
},
{
required: false,
name: "seoTitle",
label: "Seo title",
hint: "If empty the title field will be used",
widget: "string",
crowdin: true,
},
{
required: false,
name: "seoDescription",
label: "Seo description",
widget: "string",
crowdin: true,
},
{
required: false,
name: "seoFocusKeywords",
label: "Seo focus keywords",
hint: "Enter the focus keywords separated by commas",
widget: 'list',
crowdin: true,
},
{
name: "template",
widget: "select",
Expand Down
12 changes: 8 additions & 4 deletions workspaces/website/src/renderer/_default.page.server.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { renderToStream } from "react-streaming/server";
import { escapeInject } from "vite-plugin-ssr/server";
import { PageContextServer } from "./types";
import { PageContextServer, SeoType } from "./types";
import { PageShell } from "./PageShell";
import { getDefaultPageContext } from "./helpers";
import type { InjectFilterEntry } from "vite-plugin-ssr/types";
Expand Down Expand Up @@ -41,20 +41,23 @@ export async function render(pageContext: PageContextServer) {
});

const GOOGLE_TAG_ID = "G-WY42TERK5P";
const pageSeo = pageProps?.data as SeoType
const documentProps =
pageContext.documentProps ?? pageContext.exports.documentProps;

const title = documentProps?.title
? `${documentProps?.title} - Starknet`
const title = documentProps?.title ?? pageSeo?.seoTitle
? `${documentProps?.title ?? pageSeo?.seoTitle} - Starknet`
: "Starknet";

const description =
documentProps?.description ??
documentProps?.description ?? pageSeo?.seoDescription as string ??
"Starknet is the secure scaling technology bringing Ethereum’s benefits to the world.";

const image =
documentProps?.image ??
`${import.meta.env.VITE_SITE_URL}/assets/share/generic_landing.png`;

const focusKeywords = pageSeo?.seoFocusKeywords as string[]

const documentHtml = escapeInject`<!DOCTYPE html>
<html>
Expand All @@ -66,6 +69,7 @@ export async function render(pageContext: PageContextServer) {
<title>${title}</title>
<meta name="title" content="${title}">
<meta name="description" content="${description}">
<meta name="keywords" content="${focusKeywords?.join(',') ?? "starknet"}">
<!-- Open Graph / Facebook -->
<meta property="og:type" content="article">
Expand Down
6 changes: 6 additions & 0 deletions workspaces/website/src/renderer/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ export interface DocumentProps {
video?: string;
}

export type SeoType = {
seoTitle?: string;
seoDescription?: string;
seoFocusKeywords?: string[];
}

export type PageContextCustom = {
Page: Page;
pageProps?: PageProps;
Expand Down

1 comment on commit 9097710

@vercel
Copy link

@vercel vercel bot commented on 9097710 Sep 27, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

starknet-summit-website – ./workspaces/starknet-summit

starknet-summit-website.vercel.app
starknet-summit-website-yuki-labs.vercel.app
starknet-summit-website-git-production-yuki-labs.vercel.app
summit23.starknet.io

Please sign in to comment.