Skip to content

Commit

Permalink
Update page.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-at-airwalk committed Jul 8, 2024
1 parent d437de6 commit 8a27ab2
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/app/docs/[mode]/[branch]/[[...path]]/@print/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,21 +103,23 @@ export default async function Page({
if (file.endsWith('.md') || file.endsWith('.mdx')) {
// const contentKey = params.path[0] as keyof typeof siteConfig.content;
// const contentConfig = siteConfig?.content?.[contentKey];
const isGithubRepo =
contentConfig.owner &&
contentConfig.repo &&
contentConfig.branch &&
file;

if (
contentConfig?.owner &&
contentConfig?.repo &&
contentConfig?.branch &&
file
) {
if (isGithubRepo) {
const { owner, repo, branch } = contentConfig;
pageContent = await getFileContent({ owner, repo, path: file, branch });
if (pageContent && pageContent.content) {
pageContentText = pageContent?.content
? Buffer.from(pageContent.content).toString()
: '';
} else {
return notFound();
}

const { content: linkedPageContentText, context } =
await checkFrontmatter(pageContentText || '', contentConfig); // check for frontmatter context
pageContentText = linkedPageContentText;
Expand Down

0 comments on commit 8a27ab2

Please sign in to comment.