Prevent publishing of sensitive notes
I love the idea of a Digital Garden, however, there are files in my vault that I don't want to accidentally publish. For example, I have notes about family members — gift ideas, etc.
While I glance through files to look for secrets and proprietary information before publishing, I wanted to create a safeguard to prevent accidental mistakes. To accomplish this, I made two changes to the stock .eleventy.js file that comes with the Obsidian Digital Garden plugin.
Ignore files to upload by folder
To keep the contents from being published, I inserted the following line to ignore any file in my secrets folder:
module.exports = function (eleventyConfig) {
eleventyConfig.ignores.add("secrets/**");
// ... the rest is unchanged
}
Redact file titles
However, I can still leak information in file titles. For some of the files in secrets like family members, I don't want their names to appear. However, for others like year numbers, I'm okay with the title being shown.
To guard against this, in the getAnchorAttributes function, I changed const title = linkTitle? linkTitle: fileName; to:
let title = linkTitle ? linkTitle : fileName;
if (!linkTitle && (filePath.includes("secrets/people")) {
title = "[redacted]";
}
This still allows me to write a link like my wife, but I won't be accidentally publishing her name in a note link.