introducing search params for creating new pages and/or new frontmatter
stuff
This commit is contained in:
parent
530290224c
commit
0d2d4bf11e
1 changed files with 36 additions and 7 deletions
|
@ -42,7 +42,7 @@
|
||||||
hasesCandidates = hasesCandidates.filter((h) => h != newFmKey);
|
hasesCandidates = hasesCandidates.filter((h) => h != newFmKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadHugoPageMetadata() {
|
function loadHugoPageMetadata(editHash) {
|
||||||
var el = document.createElement("script");
|
var el = document.createElement("script");
|
||||||
el.onload = () => {
|
el.onload = () => {
|
||||||
v = repo.content;
|
v = repo.content;
|
||||||
|
@ -109,7 +109,7 @@
|
||||||
let tkey = Object.keys(repo.frontmatter).filter((t) => t.toLowerCase() == "title")[0];
|
let tkey = Object.keys(repo.frontmatter).filter((t) => t.toLowerCase() == "title")[0];
|
||||||
title = repo.frontmatter[tkey];
|
title = repo.frontmatter[tkey];
|
||||||
};
|
};
|
||||||
el.src = `../js/repo/${location.hash.substring(1)}.js`;
|
el.src = `../js/repo/${editHash}.js`;
|
||||||
document.body.appendChild(el);
|
document.body.appendChild(el);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,13 +152,37 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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(() => {
|
onMount(() => {
|
||||||
loadHugoPageMetadata();
|
dispatchHash();
|
||||||
|
// loadHugoPageMetadata();
|
||||||
console.dir(frontmatter);
|
console.dir(frontmatter);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$: hashChanged = ()=> dispatchHash();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:window on:keyup={keyUp} />
|
<svelte:window on:keyup={keyUp} on:hashchange={hashChanged} />
|
||||||
<main id="sandpoints">
|
<main id="sandpoints">
|
||||||
<form>
|
<form>
|
||||||
<div class="formgrid">
|
<div class="formgrid">
|
||||||
|
@ -194,6 +218,11 @@
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
{/each}
|
{/each}
|
||||||
|
{#each newFrontmatter() as nf}
|
||||||
|
{#if nf == "triad"}
|
||||||
|
<div on:click="{newTriad}">NEW TRIAD TIER</div>
|
||||||
|
{/if}
|
||||||
|
{/each}
|
||||||
</span>
|
</span>
|
||||||
<div class="formgrid">
|
<div class="formgrid">
|
||||||
<label for="pagecontent">Content:</label>
|
<label for="pagecontent">Content:</label>
|
||||||
|
|
Loading…
Add table
Reference in a new issue