Use frontmatter password if encrypting due to folder

This commit is contained in:
Yigit Colakoglu 2025-07-30 19:44:13 +02:00
parent 19abdca764
commit 33e4e8ea52
2 changed files with 6 additions and 3 deletions

View File

@ -75,8 +75,7 @@ const config: QuartzConfig = {
algorithm: "aes-256-cbc",
keyLength: 32,
iterations: 100000,
encryptedFolders: {
},
encryptedFolders: {},
ttl: 3600 * 24 * 7, // A week
}),
Plugin.Description(),

View File

@ -123,7 +123,11 @@ export const EncryptPlugin: QuartzTransformerPlugin<Partial<Options>> = (userOpt
}
if (deepestFolder) {
return String(opts.encryptedFolders[deepestFolder])
if (frontmatter?.password) { // if frontmatter has a password, use it
return frontmatter.password as string;
}
return opts.encryptedFolders[deepestFolder] as string;
}
}