Skip to content

Commit

Permalink
fix: Fix projects markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
Hayao0819 committed Nov 18, 2024
1 parent 55fcee0 commit 25d69b0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/app/(hayao)/something/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ export const generateStaticParams = () => {
};
});

//console.log(postlist);
// console.log(postlist);

return params;
};

export default function Projects(hoge: { params: { slug: string } }) {
console.log(hoge);
const postElement = getProjectFromURL(hoge.params.slug);

return postElement ? <CommonSpacer>{postElement}</CommonSpacer> : <div>404</div>;
Expand Down
10 changes: 7 additions & 3 deletions src/lib/projects/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@ export const getFetchedProjectPostList = () => {

export const getProjectFromURL = (url: string) => {
const mdFile = findMarkdownFromURL(projectsDir, url);
// console.log(mdFile);

if (mdFile) {
const projPost = getPostDataFromFile(mdFile);
// Todo: basepathは多分間違ってる
return <Markdown content={projPost.content} basepath={projPost.url} />;
const projPost = getPostDataFromFile(mdFile, {
cutHead: process.cwd().split(path.sep).length + 5,
});
// TODO: basepathがあってるか確認する

return <Markdown content={projPost.content} basepath={"/something/" + projPost.url} />;
} else {
return undefined;
}
Expand Down

0 comments on commit 25d69b0

Please sign in to comment.