Update app.js
This commit is contained in:
parent
1a8cea68e1
commit
e16969667b
1 changed files with 3 additions and 5 deletions
|
|
@ -31,12 +31,12 @@ async function init() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TOP NAV: Only folder name if ANY index.* exists
|
// TOP NAV: Only real section folders with index.*
|
||||||
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(
|
||||||
indexData.flat
|
indexData.flat
|
||||||
.filter(f => f.isIndex)
|
.filter(f => f.isIndex && f.path.split("/").length > 1)
|
||||||
.map(f => f.path.split("/")[0])
|
.map(f => f.path.split("/")[0])
|
||||||
)].sort();
|
)].sort();
|
||||||
navSections.forEach(s => {
|
navSections.forEach(s => {
|
||||||
|
|
@ -44,7 +44,7 @@ function populateNav() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// DROPDOWN: Only sections with NON-index files + default to "posts"
|
// 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 => {
|
||||||
|
|
@ -53,7 +53,6 @@ function populateSections() {
|
||||||
els.sectionSelect.appendChild(opt);
|
els.sectionSelect.appendChild(opt);
|
||||||
});
|
});
|
||||||
|
|
||||||
// DEFAULT TO "posts" IF EXISTS
|
|
||||||
if (indexData.sections.includes("posts")) {
|
if (indexData.sections.includes("posts")) {
|
||||||
els.sectionSelect.value = "posts";
|
els.sectionSelect.value = "posts";
|
||||||
} else if (indexData.sections.length > 0) {
|
} else if (indexData.sections.length > 0) {
|
||||||
|
|
@ -160,7 +159,6 @@ async function handleHash() {
|
||||||
const html = marked.parse(src || `# ${section}\n\nNo content yet.`);
|
const html = marked.parse(src || `# ${section}\n\nNo content yet.`);
|
||||||
els.viewer.innerHTML = `<article class="markdown">${html}</article>`;
|
els.viewer.innerHTML = `<article class="markdown">${html}</article>`;
|
||||||
} else {
|
} else {
|
||||||
// HTML/PDF: inject clean fallback
|
|
||||||
const iframe = document.createElement("iframe");
|
const iframe = document.createElement("iframe");
|
||||||
iframe.src = "/" + indexFile.path;
|
iframe.src = "/" + indexFile.path;
|
||||||
iframe.loading = "eager";
|
iframe.loading = "eager";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue