Overview
(A brief 1-2 sentence description of the location’s vibe or history.)
let current = dv.current();
let title = current.file?.name || current.name || "";
// 0. Suppress artwork search on template notes
if (title.toLowerCase().includes("template")) {
dv.paragraph(`*(Location / Building Image Preview)*`);
} else {
// 1. Gather all potential names (Title, quoted nicknames, and Obsidian Aliases)
let rawNames = [title];
// Extract quoted nickname if present in title (e.g. Holy Dominion "Estwatch" -> Estwatch)
let matchNick = title.match(/"([^"]+)"/);
if (matchNick && matchNick[1]) {
rawNames.push(matchNick[1]);
}
// Pull aliases safely
let aliases = current.file?.aliases || current.aliases || [];
if (typeof aliases === "string") {
rawNames.push(aliases);
} else if (Array.isArray(aliases) || (aliases && typeof aliases[Symbol.iterator] === "function")) {
for (let a of aliases) {
if (a && typeof a === "string") rawNames.push(a);
}
}
// 2. Build sanitized search terms
let searchTerms = new Set();
for (let name of rawNames) {
if (!name || typeof name !== "string") continue;
let lower = name.toLowerCase().trim().replace(/["']/g, "");
let slug = lower.replace(/[\s-]+/g, "_").replace(/^_+|_+$ /g, "");
if (lower.length >= 2) searchTerms.add(lower);
if (slug.length >= 2) searchTerms.add(slug);
}
// 3. Search target folders for matching image files (.png, .webp, .jpg, etc.)
let imageFolders = ["Images/Locations", "Image/Locations", "Images/Buildings", "Image/Buildings"];
let fallbackImage = "";
let matches = app.vault.getFiles().filter(f => {
let pathLower = f.path.toLowerCase();
let inTargetFolder = imageFolders.some(folder => pathLower.includes(folder.toLowerCase()));
if (!inTargetFolder) return false;
if (fallbackImage && pathLower.includes(fallbackImage.toLowerCase())) return false;
let imgName = f.name.toLowerCase();
return Array.from(searchTerms).some(term => term && imgName.includes(term));
});
// 4. Select match (prioritize "settlement", "overview", "cover", or "map", otherwise take the first file)
let match = matches.find(f => {
let nameLower = f.name.toLowerCase();
return nameLower.includes("settlement") || nameLower.includes("overview") || nameLower.includes("cover") || nameLower.includes("map");
}) || (matches.length > 0 ? matches[0] : null);
// 5. Render artwork, fallback image, or clean message
if (match && match.path) {
dv.paragraph(`![[${match.path}|cover]]`);
} else {
let fallbackFile = null;
if (fallbackImage && fallbackImage.trim() !== "") {
let cleanFB = fallbackImage.toLowerCase().trim();
fallbackFile = app.vault.getFiles().find(f =>
f.path.toLowerCase() === cleanFB ||
f.path.toLowerCase().includes(cleanFB) ||
f.name.toLowerCase().includes(cleanFB)
);
}
if (fallbackFile && fallbackFile.path) {
dv.paragraph(`![[${fallbackFile.path}|cover]]`);
} else {
dv.paragraph(`*No map or illustration found for ${title}*`);
}
}
}Districts
Areas & Points of Interest
Archmouth
Archmouth
Overview
(A brief 1-2 sentence description of the location’s vibe or history.)
let current = dv.current(); let title = current.file?.name || current.name || ""; // 0. Suppress artwork search on template notes if (title.toLowerCase().includes("template")) { dv.paragraph(`*(Location / Building Image Preview)*`); } else { // 1. Gather all potential names (Title, quoted nicknames, and Obsidian Aliases) let rawNames = [title]; // Extract quoted nickname if present in title (e.g. Holy Dominion "Estwatch" -> Estwatch) let matchNick = title.match(/"([^"]+)"/); if (matchNick && matchNick[1]) { rawNames.push(matchNick[1]); } // Pull aliases safely let aliases = current.file?.aliases || current.aliases || []; if (typeof aliases === "string") { rawNames.push(aliases); } else if (Array.isArray(aliases) || (aliases && typeof aliases[Symbol.iterator] === "function")) { for (let a of aliases) { if (a && typeof a === "string") rawNames.push(a); } } // 2. Build sanitized search terms let searchTerms = new Set(); for (let name of rawNames) { if (!name || typeof name !== "string") continue; let lower = name.toLowerCase().trim().replace(/["']/g, ""); let slug = lower.replace(/[\s-]+/g, "_").replace(/^_+|_+$ /g, ""); if (lower.length >= 2) searchTerms.add(lower); if (slug.length >= 2) searchTerms.add(slug); } // 3. Search target folders for matching image files (.png, .webp, .jpg, etc.) let imageFolders = ["Images/Locations", "Image/Locations", "Images/Buildings", "Image/Buildings"]; let fallbackImage = ""; let matches = app.vault.getFiles().filter(f => { let pathLower = f.path.toLowerCase(); let inTargetFolder = imageFolders.some(folder => pathLower.includes(folder.toLowerCase())); if (!inTargetFolder) return false; if (fallbackImage && pathLower.includes(fallbackImage.toLowerCase())) return false; let imgName = f.name.toLowerCase(); return Array.from(searchTerms).some(term => term && imgName.includes(term)); }); // 4. Select match (prioritize "settlement", "overview", "cover", or "map", otherwise take the first file) let match = matches.find(f => { let nameLower = f.name.toLowerCase(); return nameLower.includes("settlement") || nameLower.includes("overview") || nameLower.includes("cover") || nameLower.includes("map"); }) || (matches.length > 0 ? matches[0] : null); // 5. Render artwork, fallback image, or clean message if (match && match.path) { dv.paragraph(`![[${match.path}|cover]]`); } else { let fallbackFile = null; if (fallbackImage && fallbackImage.trim() !== "") { let cleanFB = fallbackImage.toLowerCase().trim(); fallbackFile = app.vault.getFiles().find(f => f.path.toLowerCase() === cleanFB || f.path.toLowerCase().includes(cleanFB) || f.name.toLowerCase().includes(cleanFB) ); } if (fallbackFile && fallbackFile.path) { dv.paragraph(`![[${fallbackFile.path}|cover]]`); } else { dv.paragraph(`*No map or illustration found for ${title}*`); } } }Districts
Areas & Points of Interest
Clearrock
The Port
Fortress
Eastgate
Blackshade
Cabbage Arch
The Mills
Highall
Sunrise Way
Link to originalFive Cliffs
Bastion
Bastion
Overview
(A brief 1-2 sentence description of the location’s vibe or history.)
let current = dv.current(); let title = current.file?.name || current.name || ""; // 0. Suppress artwork search on template notes if (title.toLowerCase().includes("template")) { dv.paragraph(`*(Location / Building Image Preview)*`); } else { // 1. Gather all potential names (Title, quoted nicknames, and Obsidian Aliases) let rawNames = [title]; // Extract quoted nickname if present in title (e.g. Holy Dominion "Estwatch" -> Estwatch) let matchNick = title.match(/"([^"]+)"/); if (matchNick && matchNick[1]) { rawNames.push(matchNick[1]); } // Pull aliases safely let aliases = current.file?.aliases || current.aliases || []; if (typeof aliases === "string") { rawNames.push(aliases); } else if (Array.isArray(aliases) || (aliases && typeof aliases[Symbol.iterator] === "function")) { for (let a of aliases) { if (a && typeof a === "string") rawNames.push(a); } } // 2. Build sanitized search terms let searchTerms = new Set(); for (let name of rawNames) { if (!name || typeof name !== "string") continue; let lower = name.toLowerCase().trim().replace(/["']/g, ""); let slug = lower.replace(/[\s-]+/g, "_").replace(/^_+|_+$ /g, ""); if (lower.length >= 2) searchTerms.add(lower); if (slug.length >= 2) searchTerms.add(slug); } // 3. Search target folders for matching image files (.png, .webp, .jpg, etc.) let imageFolders = ["Images/Locations", "Image/Locations", "Images/Buildings", "Image/Buildings"]; let fallbackImage = ""; let matches = app.vault.getFiles().filter(f => { let pathLower = f.path.toLowerCase(); let inTargetFolder = imageFolders.some(folder => pathLower.includes(folder.toLowerCase())); if (!inTargetFolder) return false; if (fallbackImage && pathLower.includes(fallbackImage.toLowerCase())) return false; let imgName = f.name.toLowerCase(); return Array.from(searchTerms).some(term => term && imgName.includes(term)); }); // 4. Select match (prioritize "settlement", "overview", "cover", or "map", otherwise take the first file) let match = matches.find(f => { let nameLower = f.name.toLowerCase(); return nameLower.includes("settlement") || nameLower.includes("overview") || nameLower.includes("cover") || nameLower.includes("map"); }) || (matches.length > 0 ? matches[0] : null); // 5. Render artwork, fallback image, or clean message if (match && match.path) { dv.paragraph(`![[${match.path}|cover]]`); } else { let fallbackFile = null; if (fallbackImage && fallbackImage.trim() !== "") { let cleanFB = fallbackImage.toLowerCase().trim(); fallbackFile = app.vault.getFiles().find(f => f.path.toLowerCase() === cleanFB || f.path.toLowerCase().includes(cleanFB) || f.name.toLowerCase().includes(cleanFB) ); } if (fallbackFile && fallbackFile.path) { dv.paragraph(`![[${fallbackFile.path}|cover]]`); } else { dv.paragraph(`*No map or illustration found for ${title}*`); } } }Districts
Areas & Points of Interest
Old Town
Docks District
Weavers Garden
The Brooks
The Crest
Fish Wall
Castle
Southgate
Eastgate
North Road
Summer Ward
Link to originalThe Stair
Calcheth
Calcheth
Overview
(A brief 1-2 sentence description of the location’s vibe or history.)
let current = dv.current(); let title = current.file?.name || current.name || ""; // 0. Suppress artwork search on template notes if (title.toLowerCase().includes("template")) { dv.paragraph(`*(Location / Building Image Preview)*`); } else { // 1. Gather all potential names (Title, quoted nicknames, and Obsidian Aliases) let rawNames = [title]; // Extract quoted nickname if present in title (e.g. Holy Dominion "Estwatch" -> Estwatch) let matchNick = title.match(/"([^"]+)"/); if (matchNick && matchNick[1]) { rawNames.push(matchNick[1]); } // Pull aliases safely let aliases = current.file?.aliases || current.aliases || []; if (typeof aliases === "string") { rawNames.push(aliases); } else if (Array.isArray(aliases) || (aliases && typeof aliases[Symbol.iterator] === "function")) { for (let a of aliases) { if (a && typeof a === "string") rawNames.push(a); } } // 2. Build sanitized search terms let searchTerms = new Set(); for (let name of rawNames) { if (!name || typeof name !== "string") continue; let lower = name.toLowerCase().trim().replace(/["']/g, ""); let slug = lower.replace(/[\s-]+/g, "_").replace(/^_+|_+$ /g, ""); if (lower.length >= 2) searchTerms.add(lower); if (slug.length >= 2) searchTerms.add(slug); } // 3. Search target folders for matching image files (.png, .webp, .jpg, etc.) let imageFolders = ["Images/Locations", "Image/Locations", "Images/Buildings", "Image/Buildings"]; let fallbackImage = ""; let matches = app.vault.getFiles().filter(f => { let pathLower = f.path.toLowerCase(); let inTargetFolder = imageFolders.some(folder => pathLower.includes(folder.toLowerCase())); if (!inTargetFolder) return false; if (fallbackImage && pathLower.includes(fallbackImage.toLowerCase())) return false; let imgName = f.name.toLowerCase(); return Array.from(searchTerms).some(term => term && imgName.includes(term)); }); // 4. Select match (prioritize "settlement", "overview", "cover", or "map", otherwise take the first file) let match = matches.find(f => { let nameLower = f.name.toLowerCase(); return nameLower.includes("settlement") || nameLower.includes("overview") || nameLower.includes("cover") || nameLower.includes("map"); }) || (matches.length > 0 ? matches[0] : null); // 5. Render artwork, fallback image, or clean message if (match && match.path) { dv.paragraph(`![[${match.path}|cover]]`); } else { let fallbackFile = null; if (fallbackImage && fallbackImage.trim() !== "") { let cleanFB = fallbackImage.toLowerCase().trim(); fallbackFile = app.vault.getFiles().find(f => f.path.toLowerCase() === cleanFB || f.path.toLowerCase().includes(cleanFB) || f.name.toLowerCase().includes(cleanFB) ); } if (fallbackFile && fallbackFile.path) { dv.paragraph(`![[${fallbackFile.path}|cover]]`); } else { dv.paragraph(`*No map or illustration found for ${title}*`); } } }Districts
Areas & Points of Interest
Old Town
Port District
Meadorchard
Six Mires
Chalkwall
Highyard
Cabbage Stair
Great Gate
Cattlepark
Castle
Breadbroad
Link to originalSoldier's Place
Carran
Carran
Overview
(A brief 1-2 sentence description of the location’s vibe or history.)
let current = dv.current(); let title = current.file?.name || current.name || ""; // 0. Suppress artwork search on template notes if (title.toLowerCase().includes("template")) { dv.paragraph(`*(Location / Building Image Preview)*`); } else { // 1. Gather all potential names (Title, quoted nicknames, and Obsidian Aliases) let rawNames = [title]; // Extract quoted nickname if present in title (e.g. Holy Dominion "Estwatch" -> Estwatch) let matchNick = title.match(/"([^"]+)"/); if (matchNick && matchNick[1]) { rawNames.push(matchNick[1]); } // Pull aliases safely let aliases = current.file?.aliases || current.aliases || []; if (typeof aliases === "string") { rawNames.push(aliases); } else if (Array.isArray(aliases) || (aliases && typeof aliases[Symbol.iterator] === "function")) { for (let a of aliases) { if (a && typeof a === "string") rawNames.push(a); } } // 2. Build sanitized search terms let searchTerms = new Set(); for (let name of rawNames) { if (!name || typeof name !== "string") continue; let lower = name.toLowerCase().trim().replace(/["']/g, ""); let slug = lower.replace(/[\s-]+/g, "_").replace(/^_+|_+$ /g, ""); if (lower.length >= 2) searchTerms.add(lower); if (slug.length >= 2) searchTerms.add(slug); } // 3. Search target folders for matching image files (.png, .webp, .jpg, etc.) let imageFolders = ["Images/Locations", "Image/Locations", "Images/Buildings", "Image/Buildings"]; let fallbackImage = ""; let matches = app.vault.getFiles().filter(f => { let pathLower = f.path.toLowerCase(); let inTargetFolder = imageFolders.some(folder => pathLower.includes(folder.toLowerCase())); if (!inTargetFolder) return false; if (fallbackImage && pathLower.includes(fallbackImage.toLowerCase())) return false; let imgName = f.name.toLowerCase(); return Array.from(searchTerms).some(term => term && imgName.includes(term)); }); // 4. Select match (prioritize "settlement", "overview", "cover", or "map", otherwise take the first file) let match = matches.find(f => { let nameLower = f.name.toLowerCase(); return nameLower.includes("settlement") || nameLower.includes("overview") || nameLower.includes("cover") || nameLower.includes("map"); }) || (matches.length > 0 ? matches[0] : null); // 5. Render artwork, fallback image, or clean message if (match && match.path) { dv.paragraph(`![[${match.path}|cover]]`); } else { let fallbackFile = null; if (fallbackImage && fallbackImage.trim() !== "") { let cleanFB = fallbackImage.toLowerCase().trim(); fallbackFile = app.vault.getFiles().find(f => f.path.toLowerCase() === cleanFB || f.path.toLowerCase().includes(cleanFB) || f.name.toLowerCase().includes(cleanFB) ); } if (fallbackFile && fallbackFile.path) { dv.paragraph(`![[${fallbackFile.path}|cover]]`); } else { dv.paragraph(`*No map or illustration found for ${title}*`); } } }Districts
Areas & Points of Interest
Old District
Northway
Cheese Water
Link to originalSmithsroad
Crestwood
Crestwood
Overview
(A brief 1-2 sentence description of the location’s vibe or history.)
let current = dv.current(); let title = current.file?.name || current.name || ""; // 0. Suppress artwork search on template notes if (title.toLowerCase().includes("template")) { dv.paragraph(`*(Location / Building Image Preview)*`); } else { // 1. Gather all potential names (Title, quoted nicknames, and Obsidian Aliases) let rawNames = [title]; // Extract quoted nickname if present in title (e.g. Holy Dominion "Estwatch" -> Estwatch) let matchNick = title.match(/"([^"]+)"/); if (matchNick && matchNick[1]) { rawNames.push(matchNick[1]); } // Pull aliases safely let aliases = current.file?.aliases || current.aliases || []; if (typeof aliases === "string") { rawNames.push(aliases); } else if (Array.isArray(aliases) || (aliases && typeof aliases[Symbol.iterator] === "function")) { for (let a of aliases) { if (a && typeof a === "string") rawNames.push(a); } } // 2. Build sanitized search terms let searchTerms = new Set(); for (let name of rawNames) { if (!name || typeof name !== "string") continue; let lower = name.toLowerCase().trim().replace(/["']/g, ""); let slug = lower.replace(/[\s-]+/g, "_").replace(/^_+|_+$ /g, ""); if (lower.length >= 2) searchTerms.add(lower); if (slug.length >= 2) searchTerms.add(slug); } // 3. Search target folders for matching image files (.png, .webp, .jpg, etc.) let imageFolders = ["Images/Locations", "Image/Locations", "Images/Buildings", "Image/Buildings"]; let fallbackImage = ""; let matches = app.vault.getFiles().filter(f => { let pathLower = f.path.toLowerCase(); let inTargetFolder = imageFolders.some(folder => pathLower.includes(folder.toLowerCase())); if (!inTargetFolder) return false; if (fallbackImage && pathLower.includes(fallbackImage.toLowerCase())) return false; let imgName = f.name.toLowerCase(); return Array.from(searchTerms).some(term => term && imgName.includes(term)); }); // 4. Select match (prioritize "settlement", "overview", "cover", or "map", otherwise take the first file) let match = matches.find(f => { let nameLower = f.name.toLowerCase(); return nameLower.includes("settlement") || nameLower.includes("overview") || nameLower.includes("cover") || nameLower.includes("map"); }) || (matches.length > 0 ? matches[0] : null); // 5. Render artwork, fallback image, or clean message if (match && match.path) { dv.paragraph(`![[${match.path}|cover]]`); } else { let fallbackFile = null; if (fallbackImage && fallbackImage.trim() !== "") { let cleanFB = fallbackImage.toLowerCase().trim(); fallbackFile = app.vault.getFiles().find(f => f.path.toLowerCase() === cleanFB || f.path.toLowerCase().includes(cleanFB) || f.name.toLowerCase().includes(cleanFB) ); } if (fallbackFile && fallbackFile.path) { dv.paragraph(`![[${fallbackFile.path}|cover]]`); } else { dv.paragraph(`*No map or illustration found for ${title}*`); } } }Districts
Areas & Points of Interest
The Cross
Highlodge
The Docks
The Meadows
Spirit Shade
Charpole
Oldmile
Link to originalThe Rock
Cromer
Cromer
Overview
(A brief 1-2 sentence description of the location’s vibe or history.)
let current = dv.current(); let title = current.file?.name || current.name || ""; // 0. Suppress artwork search on template notes if (title.toLowerCase().includes("template")) { dv.paragraph(`*(Location / Building Image Preview)*`); } else { // 1. Gather all potential names (Title, quoted nicknames, and Obsidian Aliases) let rawNames = [title]; // Extract quoted nickname if present in title (e.g. Holy Dominion "Estwatch" -> Estwatch) let matchNick = title.match(/"([^"]+)"/); if (matchNick && matchNick[1]) { rawNames.push(matchNick[1]); } // Pull aliases safely let aliases = current.file?.aliases || current.aliases || []; if (typeof aliases === "string") { rawNames.push(aliases); } else if (Array.isArray(aliases) || (aliases && typeof aliases[Symbol.iterator] === "function")) { for (let a of aliases) { if (a && typeof a === "string") rawNames.push(a); } } // 2. Build sanitized search terms let searchTerms = new Set(); for (let name of rawNames) { if (!name || typeof name !== "string") continue; let lower = name.toLowerCase().trim().replace(/["']/g, ""); let slug = lower.replace(/[\s-]+/g, "_").replace(/^_+|_+$ /g, ""); if (lower.length >= 2) searchTerms.add(lower); if (slug.length >= 2) searchTerms.add(slug); } // 3. Search target folders for matching image files (.png, .webp, .jpg, etc.) let imageFolders = ["Images/Locations", "Image/Locations", "Images/Buildings", "Image/Buildings"]; let fallbackImage = ""; let matches = app.vault.getFiles().filter(f => { let pathLower = f.path.toLowerCase(); let inTargetFolder = imageFolders.some(folder => pathLower.includes(folder.toLowerCase())); if (!inTargetFolder) return false; if (fallbackImage && pathLower.includes(fallbackImage.toLowerCase())) return false; let imgName = f.name.toLowerCase(); return Array.from(searchTerms).some(term => term && imgName.includes(term)); }); // 4. Select match (prioritize "settlement", "overview", "cover", or "map", otherwise take the first file) let match = matches.find(f => { let nameLower = f.name.toLowerCase(); return nameLower.includes("settlement") || nameLower.includes("overview") || nameLower.includes("cover") || nameLower.includes("map"); }) || (matches.length > 0 ? matches[0] : null); // 5. Render artwork, fallback image, or clean message if (match && match.path) { dv.paragraph(`![[${match.path}|cover]]`); } else { let fallbackFile = null; if (fallbackImage && fallbackImage.trim() !== "") { let cleanFB = fallbackImage.toLowerCase().trim(); fallbackFile = app.vault.getFiles().find(f => f.path.toLowerCase() === cleanFB || f.path.toLowerCase().includes(cleanFB) || f.name.toLowerCase().includes(cleanFB) ); } if (fallbackFile && fallbackFile.path) { dv.paragraph(`![[${fallbackFile.path}|cover]]`); } else { dv.paragraph(`*No map or illustration found for ${title}*`); } } }Districts
Areas & Points of Interest
Long Song
Dairy Gate
East Gate
Link to originalTimber Well
Keld
Keld
Overview
(A brief 1-2 sentence description of the location’s vibe or history.)
let current = dv.current(); let title = current.file?.name || current.name || ""; // 0. Suppress artwork search on template notes if (title.toLowerCase().includes("template")) { dv.paragraph(`*(Location / Building Image Preview)*`); } else { // 1. Gather all potential names (Title, quoted nicknames, and Obsidian Aliases) let rawNames = [title]; // Extract quoted nickname if present in title (e.g. Holy Dominion "Estwatch" -> Estwatch) let matchNick = title.match(/"([^"]+)"/); if (matchNick && matchNick[1]) { rawNames.push(matchNick[1]); } // Pull aliases safely let aliases = current.file?.aliases || current.aliases || []; if (typeof aliases === "string") { rawNames.push(aliases); } else if (Array.isArray(aliases) || (aliases && typeof aliases[Symbol.iterator] === "function")) { for (let a of aliases) { if (a && typeof a === "string") rawNames.push(a); } } // 2. Build sanitized search terms let searchTerms = new Set(); for (let name of rawNames) { if (!name || typeof name !== "string") continue; let lower = name.toLowerCase().trim().replace(/["']/g, ""); let slug = lower.replace(/[\s-]+/g, "_").replace(/^_+|_+$ /g, ""); if (lower.length >= 2) searchTerms.add(lower); if (slug.length >= 2) searchTerms.add(slug); } // 3. Search target folders for matching image files (.png, .webp, .jpg, etc.) let imageFolders = ["Images/Locations", "Image/Locations", "Images/Buildings", "Image/Buildings"]; let fallbackImage = ""; let matches = app.vault.getFiles().filter(f => { let pathLower = f.path.toLowerCase(); let inTargetFolder = imageFolders.some(folder => pathLower.includes(folder.toLowerCase())); if (!inTargetFolder) return false; if (fallbackImage && pathLower.includes(fallbackImage.toLowerCase())) return false; let imgName = f.name.toLowerCase(); return Array.from(searchTerms).some(term => term && imgName.includes(term)); }); // 4. Select match (prioritize "settlement", "overview", "cover", or "map", otherwise take the first file) let match = matches.find(f => { let nameLower = f.name.toLowerCase(); return nameLower.includes("settlement") || nameLower.includes("overview") || nameLower.includes("cover") || nameLower.includes("map"); }) || (matches.length > 0 ? matches[0] : null); // 5. Render artwork, fallback image, or clean message if (match && match.path) { dv.paragraph(`![[${match.path}|cover]]`); } else { let fallbackFile = null; if (fallbackImage && fallbackImage.trim() !== "") { let cleanFB = fallbackImage.toLowerCase().trim(); fallbackFile = app.vault.getFiles().find(f => f.path.toLowerCase() === cleanFB || f.path.toLowerCase().includes(cleanFB) || f.name.toLowerCase().includes(cleanFB) ); } if (fallbackFile && fallbackFile.path) { dv.paragraph(`![[${fallbackFile.path}|cover]]`); } else { dv.paragraph(`*No map or illustration found for ${title}*`); } } }Districts
Areas & Points of Interest
Dog Meadow
South District
Iron Gate
Golden Yard
Link to originalSmall Square
Mosshield
Mosshield
Overview
(A brief 1-2 sentence description of the location’s vibe or history.)
let current = dv.current(); let title = current.file?.name || current.name || ""; // 0. Suppress artwork search on template notes if (title.toLowerCase().includes("template")) { dv.paragraph(`*(Location / Building Image Preview)*`); } else { // 1. Gather all potential names (Title, quoted nicknames, and Obsidian Aliases) let rawNames = [title]; // Extract quoted nickname if present in title (e.g. Holy Dominion "Estwatch" -> Estwatch) let matchNick = title.match(/"([^"]+)"/); if (matchNick && matchNick[1]) { rawNames.push(matchNick[1]); } // Pull aliases safely let aliases = current.file?.aliases || current.aliases || []; if (typeof aliases === "string") { rawNames.push(aliases); } else if (Array.isArray(aliases) || (aliases && typeof aliases[Symbol.iterator] === "function")) { for (let a of aliases) { if (a && typeof a === "string") rawNames.push(a); } } // 2. Build sanitized search terms let searchTerms = new Set(); for (let name of rawNames) { if (!name || typeof name !== "string") continue; let lower = name.toLowerCase().trim().replace(/["']/g, ""); let slug = lower.replace(/[\s-]+/g, "_").replace(/^_+|_+$ /g, ""); if (lower.length >= 2) searchTerms.add(lower); if (slug.length >= 2) searchTerms.add(slug); } // 3. Search target folders for matching image files (.png, .webp, .jpg, etc.) let imageFolders = ["Images/Locations", "Image/Locations", "Images/Buildings", "Image/Buildings"]; let fallbackImage = ""; let matches = app.vault.getFiles().filter(f => { let pathLower = f.path.toLowerCase(); let inTargetFolder = imageFolders.some(folder => pathLower.includes(folder.toLowerCase())); if (!inTargetFolder) return false; if (fallbackImage && pathLower.includes(fallbackImage.toLowerCase())) return false; let imgName = f.name.toLowerCase(); return Array.from(searchTerms).some(term => term && imgName.includes(term)); }); // 4. Select match (prioritize "settlement", "overview", "cover", or "map", otherwise take the first file) let match = matches.find(f => { let nameLower = f.name.toLowerCase(); return nameLower.includes("settlement") || nameLower.includes("overview") || nameLower.includes("cover") || nameLower.includes("map"); }) || (matches.length > 0 ? matches[0] : null); // 5. Render artwork, fallback image, or clean message if (match && match.path) { dv.paragraph(`![[${match.path}|cover]]`); } else { let fallbackFile = null; if (fallbackImage && fallbackImage.trim() !== "") { let cleanFB = fallbackImage.toLowerCase().trim(); fallbackFile = app.vault.getFiles().find(f => f.path.toLowerCase() === cleanFB || f.path.toLowerCase().includes(cleanFB) || f.name.toLowerCase().includes(cleanFB) ); } if (fallbackFile && fallbackFile.path) { dv.paragraph(`![[${fallbackFile.path}|cover]]`); } else { dv.paragraph(`*No map or illustration found for ${title}*`); } } }Districts
Areas & Points of Interest
Old District
Redgrove
Fairyway
Forest Field
Egg Row
Link to originalMilk Gate
Whitebridge
Whitebridge
Overview
(A brief 1-2 sentence description of the location’s vibe or history.)
let current = dv.current(); let title = current.file?.name || current.name || ""; // 0. Suppress artwork search on template notes if (title.toLowerCase().includes("template")) { dv.paragraph(`*(Location / Building Image Preview)*`); } else { // 1. Gather all potential names (Title, quoted nicknames, and Obsidian Aliases) let rawNames = [title]; // Extract quoted nickname if present in title (e.g. Holy Dominion "Estwatch" -> Estwatch) let matchNick = title.match(/"([^"]+)"/); if (matchNick && matchNick[1]) { rawNames.push(matchNick[1]); } // Pull aliases safely let aliases = current.file?.aliases || current.aliases || []; if (typeof aliases === "string") { rawNames.push(aliases); } else if (Array.isArray(aliases) || (aliases && typeof aliases[Symbol.iterator] === "function")) { for (let a of aliases) { if (a && typeof a === "string") rawNames.push(a); } } // 2. Build sanitized search terms let searchTerms = new Set(); for (let name of rawNames) { if (!name || typeof name !== "string") continue; let lower = name.toLowerCase().trim().replace(/["']/g, ""); let slug = lower.replace(/[\s-]+/g, "_").replace(/^_+|_+$ /g, ""); if (lower.length >= 2) searchTerms.add(lower); if (slug.length >= 2) searchTerms.add(slug); } // 3. Search target folders for matching image files (.png, .webp, .jpg, etc.) let imageFolders = ["Images/Locations", "Image/Locations", "Images/Buildings", "Image/Buildings"]; let fallbackImage = ""; let matches = app.vault.getFiles().filter(f => { let pathLower = f.path.toLowerCase(); let inTargetFolder = imageFolders.some(folder => pathLower.includes(folder.toLowerCase())); if (!inTargetFolder) return false; if (fallbackImage && pathLower.includes(fallbackImage.toLowerCase())) return false; let imgName = f.name.toLowerCase(); return Array.from(searchTerms).some(term => term && imgName.includes(term)); }); // 4. Select match (prioritize "settlement", "overview", "cover", or "map", otherwise take the first file) let match = matches.find(f => { let nameLower = f.name.toLowerCase(); return nameLower.includes("settlement") || nameLower.includes("overview") || nameLower.includes("cover") || nameLower.includes("map"); }) || (matches.length > 0 ? matches[0] : null); // 5. Render artwork, fallback image, or clean message if (match && match.path) { dv.paragraph(`![[${match.path}|cover]]`); } else { let fallbackFile = null; if (fallbackImage && fallbackImage.trim() !== "") { let cleanFB = fallbackImage.toLowerCase().trim(); fallbackFile = app.vault.getFiles().find(f => f.path.toLowerCase() === cleanFB || f.path.toLowerCase().includes(cleanFB) || f.name.toLowerCase().includes(cleanFB) ); } if (fallbackFile && fallbackFile.path) { dv.paragraph(`![[${fallbackFile.path}|cover]]`); } else { dv.paragraph(`*No map or illustration found for ${title}*`); } } }Districts
Areas & Points of Interest
Mistrock
Military Ward
Clearpark
Farbrook
Southside
Meattown
Shadow Well
Link to originalWest District








