Update app.js

This commit is contained in:
Mark Randall Havens △ The Empathic Technologist ⟁ Doctor Who 42 2025-11-08 19:27:17 -06:00 committed by GitHub
parent 391c939f10
commit 2d7ae127d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -31,7 +31,7 @@ async function init() {
} }
} }
// Only show folder name if any index.* exists // TOP NAV: Only folder name if ANY index.* exists
function populateNav() { function populateNav() {
els.primaryNav.innerHTML = '<a href="#/">Home</a>'; els.primaryNav.innerHTML = '<a href="#/">Home</a>';
const navSections = [...new Set( const navSections = [...new Set(
@ -44,6 +44,7 @@ function populateNav() {
}); });
} }
// DROPDOWN: Only sections with NON-index files
function populateSections() { function populateSections() {
els.sectionSelect.innerHTML = '<option value="all">All Sections</option>'; els.sectionSelect.innerHTML = '<option value="all">All Sections</option>';
indexData.sections.forEach(s => { indexData.sections.forEach(s => {
@ -103,7 +104,7 @@ function renderList() {
const mode = els.searchMode.value; const mode = els.searchMode.value;
const query = els.searchBox.value.toLowerCase(); const query = els.searchBox.value.toLowerCase();
let posts = indexData.flat.filter(p => !p.isIndex); let posts = indexData.flat.filter(p => !p.isIndex); // NEVER show index.*
if (section !== "all") posts = posts.filter(p => p.path.split('/')[0] === section); if (section !== "all") posts = posts.filter(p => p.path.split('/')[0] === section);
if (tags.length) posts = posts.filter(p => tags.every(t => p.tags.includes(t))); if (tags.length) posts = posts.filter(p => tags.every(t => p.tags.includes(t)));
if (query) { if (query) {
@ -145,6 +146,7 @@ async function handleHash() {
if (indexFile) { if (indexFile) {
indexFile.ext === ".md" ? await renderMarkdown(indexFile.path) : renderIframe(indexFile.path); indexFile.ext === ".md" ? await renderMarkdown(indexFile.path) : renderIframe(indexFile.path);
} else { } else {
// NEVER show "index.html" fallback
els.sectionSelect.value = section; els.sectionSelect.value = section;
renderList(); renderList();
loadDefaultForSection(section); loadDefaultForSection(section);