diff --git a/public/app.js b/public/app.js
index 5aaa285..b2ea4c9 100755
--- a/public/app.js
+++ b/public/app.js
@@ -44,7 +44,7 @@ function populateNav() {
});
}
-// DROPDOWN: Only sections with NON-index files
+// DROPDOWN: Only sections with NON-index files + default to "posts"
function populateSections() {
els.sectionSelect.innerHTML = '';
indexData.sections.forEach(s => {
@@ -52,6 +52,13 @@ function populateSections() {
opt.value = s; opt.textContent = s;
els.sectionSelect.appendChild(opt);
});
+
+ // DEFAULT TO "posts" IF EXISTS
+ if (indexData.sections.includes("posts")) {
+ els.sectionSelect.value = "posts";
+ } else if (indexData.sections.length > 0) {
+ els.sectionSelect.value = indexData.sections[0];
+ }
}
function populateTags() {
@@ -147,14 +154,35 @@ async function handleHash() {
);
if (indexFile) {
- // ALWAYS render the index file — never show file name
try {
if (indexFile.ext === ".md") {
const src = await fetch(indexFile.path).then(r => r.ok ? r.text() : "");
- const html = marked.parse(src || "# " + section);
+ const html = marked.parse(src || `# ${section}\n\nNo content yet.`);
els.viewer.innerHTML = `
No content yet.
+No content yet.
`; @@ -201,9 +229,14 @@ function renderIframe(rel) { } function renderDefault() { - const latest = indexData.flat.filter(f => !f.isIndex).sort((a,b) => b.mtime - a.mtime)[0]; - if (latest) location.hash = `#/${latest.path}`; - else els.viewer.innerHTML = "Add content to begin.
"; + const defaultSection = indexData.sections.includes("posts") ? "posts" : (indexData.sections[0] || null); + if (defaultSection) { + els.sectionSelect.value = defaultSection; + renderList(); + loadDefaultForSection(defaultSection); + } else { + els.viewer.innerHTML = "Add content to begin.
"; + } } init(); \ No newline at end of file