diff --git a/src/App.svelte b/src/App.svelte index 65d9482..c6505ea 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -42,7 +42,7 @@ hasesCandidates = hasesCandidates.filter((h) => h != newFmKey); } - function loadHugoPageMetadata() { + function loadHugoPageMetadata(editHash) { var el = document.createElement("script"); el.onload = () => { v = repo.content; @@ -109,7 +109,7 @@ let tkey = Object.keys(repo.frontmatter).filter((t) => t.toLowerCase() == "title")[0]; title = repo.frontmatter[tkey]; }; - el.src = `../js/repo/${location.hash.substring(1)}.js`; + el.src = `../js/repo/${editHash}.js`; document.body.appendChild(el); } @@ -152,13 +152,37 @@ } } - onMount(() => { - loadHugoPageMetadata(); - console.dir(frontmatter); - }); + function newFrontmatter() { + return Object.entries(frontmatter).filter(val => val[1].length == 0).map(key => key[0]) + } + + function newTriad() { + let t = {} + t["detail"] = ["triad", 0, "authors", "editors"] + newHasTiers(t) + } + + function dispatchHash() { + var searchParams = new URLSearchParams(location.search); + let editHash = searchParams.get('edit') + if (editHash) { + loadHugoPageMetadata(editHash) + } else { + let newPage = searchParams.get('new') + console.log(newPage) + } + } + + onMount(() => { + dispatchHash(); + // loadHugoPageMetadata(); + console.dir(frontmatter); + }); + + $: hashChanged = ()=> dispatchHash(); - +
@@ -194,6 +218,11 @@ {/if} {/each} {/each} + {#each newFrontmatter() as nf} + {#if nf == "triad"} +
NEW TRIAD TIER
+ {/if} + {/each}