diff --git a/quartz/plugins/transformers/lastmod.ts b/quartz/plugins/transformers/lastmod.ts index 3dd3f1556..591e454ba 100644 --- a/quartz/plugins/transformers/lastmod.ts +++ b/quartz/plugins/transformers/lastmod.ts @@ -58,8 +58,16 @@ export const CreatedModifiedDate: QuartzTransformerPlugin> = (u // Get a reference to the main git repo. // It's either the same as the workdir, // or 1+ level higher in case of a submodule/subtree setup - repo = await Repository.discover(file.cwd, { search: true }); - console.log(chalk.green(`Git repository found at: ${repo.path()}`)); + console.log(`Current working directory: ${file.cwd}`); + console.log(`Attempting to discover Git repository from: ${path.join(file.cwd, 'content')}`); + + try { + repo = await Repository.discover(path.join(file.cwd, 'content'), { search: true }); + console.log(chalk.green(`Git repository found at: ${repo.path()}`)); + } catch (error) { + console.log(chalk.red(`Error discovering Git repository: ${error.message}`)); + repo = undefined; + } } try {