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

Add missing seo fields #1482

Merged
merged 1 commit into from
Oct 3, 2023
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
16 changes: 16 additions & 0 deletions workspaces/cms-config/src/collections/posts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,22 @@ export const postsCollectionConfig = {
label: "Short Description",
widget: "text",
},
{
required: false,
name: "seoFocusKeywords",
label: "Seo focus keywords",
hint: "Enter the focus keywords separated by commas",
widget: 'list',
crowdin: true,
},
{
required: false,
name: "seoCanonicalUrl",
label: "Seo Canonical url",
hint: "If the article was lifted from somewhere else, you can link it here",
widget: 'string',
crowdin: true,
},
{
name: "blocks",
label: "Blocks",
Expand Down
23 changes: 23 additions & 0 deletions workspaces/cms-config/src/collections/roadmapPosts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,29 @@ export const roadmapPostsCollectionConfig = {
widget: "string",
crowdin: true,
},
{
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: "availability",
label: "Availability",
Expand Down
23 changes: 23 additions & 0 deletions workspaces/cms-config/src/collections/tutorials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,29 @@ export const tutorialsCollectionConfig = {
widget: "string",
crowdin: true
},
{
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: "authors",
label: "Authors",
Expand Down
10 changes: 7 additions & 3 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, SeoType } from "./types";
import { DocumentProps, 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,9 +41,9 @@ export async function render(pageContext: PageContextServer) {
});

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

const title = documentProps?.title ?? pageSeo?.seoTitle
? `${documentProps?.title ?? pageSeo?.seoTitle} - Starknet`
Expand Down Expand Up @@ -115,6 +115,10 @@ export async function render(pageContext: PageContextServer) {
a.appendChild(r);
})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');
</script>

${pageSeo?.seoCanonicalUrl ? `
<link rel="canonical" href="${pageSeo?.seoCanonicalUrl}" />
`: ''}
</head>
<body>
<div id="page-view">${stream}</div>
Expand Down
1 change: 1 addition & 0 deletions workspaces/website/src/renderer/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export interface DocumentProps {

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