Skip to content

Commit

Permalink
feat(blog): simplify __dirname
Browse files Browse the repository at this point in the history
  • Loading branch information
noghartt committed Jul 16, 2024
1 parent 0c2720e commit 80943ab
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/pages/blog/[slug]/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,19 @@ export async function getStaticPaths() {
const posts = await getCollection('blog');
const postsMapped = posts.map(async post => {
const file = path.join(process.cwd(), 'src', 'content', 'blog', post.id);
console.log({ file });
// @ts-ignore
const __dirname = path.dirname(import.meta.dirname);
const file = path.join(__dirname, '..', '..', 'content', 'blog', post.id);
let lastCommit: GitLogCommit | null = null;
try {
const log = await git.log({ file });
lastCommit = log.latest;
console.log(lastCommit);
console.log({ log, file })
} catch (err) {
console.log(err);
}
const commits = await git.log();
console.log({
commits: commits.all.length,
});
return {
params: {
slug: post.slug,
Expand Down

0 comments on commit 80943ab

Please sign in to comment.