If you are using the Folder Notes and want it published check this out:
[Folder Notes in Obsidian Publish](https://hoverbear.org/blog/folder-notes-in-obsidian-publish/)
There is a know incompatibility with this script and the TTRPG Tools- Publish.
To solve this search for the end of this block:
// BEGIN TTRPGTOOLS_ZOOMMAP_PUBLISH
...
// END TTRPGTOOLS_ZOOMMAP_PUBLISH
And then after this block copy this new block:
```js
/* BEGIN USER_FOLDER_NOTES */
(function () {
"use strict";
const folderNoteExpandableSelector =
"div.tree-item-self.mod-collapsible:not(.mod-root)";
const folderNoteIndividualSelector =
"div.tree-item-self:not(.mod-collapsible):not(.mod-root)";
function getLastPathPart(path) {
const parts = String(path || "").split("/").filter(Boolean);
return parts.length ? parts[parts.length - 1] : "";
}
function getPublishApp() {
return window.app || null;
}
function pageExists(path) {
const app = getPublishApp();
try {
if (
app &&
app.site &&
app.site.cache &&
typeof app.site.cache.getCache === "function"
) {
return app.site.cache.getCache(path) != null;
}
} catch (e) {
console.warn("Folder Notes: cache lookup failed", e);
}
return false;
}
function navigateTo(path) {
const app = getPublishApp();
try {
if (app && typeof app.navigate === "function") {
app.navigate(path, "", null);
return;
}
} catch (e) {
console.warn("Folder Notes: app.navigate failed", e);
}
// Fallback: normal navigation.
const clean = String(path || "").replace(/\.md$/i, "");
window.location.href = "/" + encodeURI(clean);
}
function updateFolderNoteExpandable(expandableElem) {
if (!(expandableElem instanceof HTMLElement)) return;
if (expandableElem.dataset.folderNotesWired === "true") return;
const path = expandableElem.getAttribute("data-path");
if (!path) return;
const folderName = getLastPathPart(path);
if (!folderName) return;
// Default Folder Notes format:
// Folder/Subfolder/Subfolder.md
const pathWithFolderNote = `${path}/${folderName}.md`;
if (!pageExists(pathWithFolderNote)) return;
expandableElem.dataset.folderNotesWired = "true";
expandableElem.classList.add("has-folder-note");
const expandableInnerElem = expandableElem.querySelector(
"div.tree-item-inner"
);
if (!expandableInnerElem) return;
expandableInnerElem.addEventListener("click", function (ev) {
// Avoid also toggling/collapsing if possible.
ev.preventDefault();
ev.stopPropagation();
navigateTo(pathWithFolderNote);
});
}
function updateFolderNoteIndividual(individualElem) {
if (!(individualElem instanceof HTMLElement)) return;
const individualElemPath = individualElem.getAttribute("data-path");
if (!individualElemPath) return;
const fileName = getLastPathPart(individualElemPath);
if (!fileName.endsWith(".md")) return;
const fileNameExtensionless = fileName.replace(/\.md$/i, "");
const folderNotePath = individualElemPath.replace(
`${fileNameExtensionless}/${fileName}`,
fileNameExtensionless
);
if (individualElemPath === folderNotePath) return;
const candidates = document.querySelectorAll(folderNoteExpandableSelector);
let found = false;
for (const elem of candidates) {
if (elem.getAttribute("data-path") === folderNotePath) {
found = true;
break;
}
}
if (!found) return;
individualElem.classList.add("folder-note");
}
function updateFolderNotes(rootElem) {
if (!rootElem) return;
// If a Text node or other non-element is passed by MutationObserver, ignore it.
if (
rootElem !== document &&
!(rootElem instanceof HTMLElement) &&
!(rootElem instanceof Document)
) {
return;
}
try {
if (
rootElem instanceof HTMLElement &&
rootElem.matches(folderNoteIndividualSelector)
) {
updateFolderNoteIndividual(rootElem);
}
if (
rootElem instanceof HTMLElement &&
rootElem.matches(folderNoteExpandableSelector)
) {
updateFolderNoteExpandable(rootElem);
}
if (typeof rootElem.querySelectorAll !== "function") return;
for (const individualElem of rootElem.querySelectorAll(
folderNoteIndividualSelector
)) {
updateFolderNoteIndividual(individualElem);
}
for (const expandableElem of rootElem.querySelectorAll(
folderNoteExpandableSelector
)) {
updateFolderNoteExpandable(expandableElem);
}
} catch (e) {
console.warn("Folder Notes: update failed", e);
}
}
function injectFolderNoteObserver() {
updateFolderNotes(document);
const nav =
document.querySelector("div.nav-view") ||
document.querySelector(".site-body-left-column") ||
document.querySelector("nav") ||
document.body;
if (!nav) {
console.warn("Folder Notes: nav root not found");
return;
}
const observer = new MutationObserver(function (mutationList) {
for (const mutation of mutationList) {
if (mutation.type !== "childList") continue;
for (const addedNode of mutation.addedNodes) {
updateFolderNotes(addedNode);
}
}
});
observer.observe(nav, {
childList: true,
subtree: true,
});
}
function start() {
try {
injectFolderNoteObserver();
} catch (e) {
console.warn("Folder Notes: startup failed", e);
}
}
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", start);
} else {
start();
}
})();
/* END USER_FOLDER_NOTES */
```