Skip to content

Commit

Permalink
various dev content fixes (#40)
Browse files Browse the repository at this point in the history
* fix: use seo title

* fix: edit on github urls

* fix: redirects

* feat: added redirect
  • Loading branch information
nickfrosty authored Sep 13, 2024
1 parent 9598941 commit f9b6876
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 12 deletions.
2 changes: 1 addition & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
/// <reference types="next/navigation-types/compat/navigation" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
// see https://nextjs.org/docs/basic-features/typescript for more information.
16 changes: 12 additions & 4 deletions rewrites-redirects.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,20 @@
"destination": "/docs/intro/dev"
},
{
"source": "/simd",
"destination": "https://github.com/solana-foundation/solana-improvement-documents"
"source": "/install",
"destination": "/docs/intro/installation"
},
{
"source": "/cli",
"destination": "/docs/intro/installation#install-the-solana-cli"
},
{
"source": "/developers/guides/solang/getting-started",
"destination": "/developers/guides/getstarted/hello-world-in-your-browser"
"source": "/setup",
"destination": "/docs/intro/installation"
},
{
"source": "/simd",
"destination": "https://github.com/solana-foundation/solana-improvement-documents"
},
{
"source": "/developers/courses/lesson",
Expand Down
2 changes: 1 addition & 1 deletion src/pages/developers/cookbook/[[...slug]].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export default function Cookbook({
return (
<DocsLayout>
<HTMLHead
title={record?.title || "Solana Cookbook"}
title={record?.seoTitle || record?.title || "Solana Cookbook"}
description={record?.description || ""}
socialShare={!!record.href ? `/opengraph${record.href}` : undefined}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/developers/courses/[course]/[lesson]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default function SingleDeveloperCourseLessonPage({
return (
<DevelopersLayout>
<HTMLHead
title={record.title || "Developer Course Lesson"}
title={record?.seoTitle || record?.title || "Developer Course Lesson"}
description={record.description || ""}
socialShare={!!record.href ? `/opengraph${record.href}` : undefined}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/developers/guides/[...slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function SingleDeveloperGuidePage({
return (
<DevelopersLayout>
<HTMLHead
title={record.title || "Developer Guide"}
title={record?.seoTitle || record?.title || "Developer Guide"}
description={record.description || ""}
socialShare={!!record.href ? `/opengraph${record.href}` : undefined}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/developers/resources/[...slug].jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default function SingleDeveloperGuidePage({ record, source }) {
return (
<DevelopersLayout>
<HTMLHead
title={record.title || "Developer Guide"}
title={record?.seoTitle || record?.title || "Developer Guide"}
description={record.description || ""}
/>
<DevelopersContentPage
Expand Down
2 changes: 1 addition & 1 deletion src/pages/docs/[[...slug]].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default function DeveloperDocs({
return (
<DocsLayout>
<HTMLHead
title={record?.title || "Documentation"}
title={record?.seoTitle || record?.title || "Documentation"}
description={record?.description || ""}
socialShare={
!!record.href ? `/opengraph/developers${record.href}` : undefined
Expand Down
4 changes: 3 additions & 1 deletion src/pages/docs/rpc/[[...slug]].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ export default function DeveloperRPCDocs({
return (
<DocsLayout>
<HTMLHead
title={record.title ? record.title : "RPC Documentation"}
title={
record?.seoTitle || record?.title ? record.title : "RPC Documentation"
}
description={record?.description || ""}
socialShare={
!!record.href ? `/opengraph/developers${record.href}` : undefined
Expand Down
4 changes: 3 additions & 1 deletion src/utils/contentApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,9 @@ export default class ContentApi {
if (!filePath) return repoUrl;
else if (!filePath.startsWith("/")) filePath = `/${filePath}`;

return new URL(`${repoUrl}/tree/main${filePath}`).toString();
const url = new URL(`${repoUrl}/blob/main${filePath}`);
url.searchParams.set("plain", "1");
return url.toString();
}

/**
Expand Down

0 comments on commit f9b6876

Please sign in to comment.