From 6d1edebaaabeb8870e0dd826f323457e8ce82785 Mon Sep 17 00:00:00 2001 From: Struchkov Mark Date: Sat, 7 Sep 2024 10:25:07 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=BE=D0=BF=D1=8B=D1=82=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=BD=D0=B0=D1=81=D1=82=D1=80=D0=BE=D0=B8=D1=82=D1=8C=20=D0=B2?= =?UTF-8?q?=D1=80=D0=B5=D0=BC=D1=8F=20=D0=BC=D0=B0=D1=82=D0=B5=D1=80=D0=B8?= =?UTF-8?q?=D0=B0=D0=BB=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- quartz/plugins/transformers/lastmod.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/quartz/plugins/transformers/lastmod.ts b/quartz/plugins/transformers/lastmod.ts index fd80871be..21edb2628 100644 --- a/quartz/plugins/transformers/lastmod.ts +++ b/quartz/plugins/transformers/lastmod.ts @@ -41,7 +41,8 @@ export const CreatedModifiedDate: QuartzTransformerPlugin> = (u let published: MaybeDate = undefined const fp = file.data.filePath! - const fullFp = path.isAbsolute(fp) ? fp : path.posix.join(file.cwd, fp) + const repoRoot = path.resolve(file.cwd, "content"); // Указываем путь к корневой папке репозитория + const fullFp = path.isAbsolute(fp) ? fp : path.join(repoRoot, fp); // Создаем абсолютный путь for (const source of opts.priority) { if (source === "filesystem") { const st = await fs.promises.stat(fullFp) @@ -58,12 +59,13 @@ 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 = Repository.discover("/usr/src/app/content") + repo = Repository.discover(repoRoot) console.log(chalk.green(`Git repository found at: ${repo.path()}`)); } try { - modified ||= await repo.getFileLatestModifiedDateAsync(file.data.filePath!) + const relativePathToRepo = path.relative(repoRoot, fullFp); + modified ||= await repo.getFileLatestModifiedDateAsync(relativePathToRepo) } catch { console.log( chalk.yellow(