diff --git a/src/App.svelte b/src/App.svelte index 9c9e452..05bb0e3 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -3,18 +3,27 @@ let v = "loading..."; let path = "loading..."; - function generateFrontMatter(frontmatter, path, protocol) { + function generateFrontMatter(frontmatter, path, relpermalink, protocol) { let dvm = document.querySelector('form') + + var hiddenRelPath = document.createElement('input') + hiddenRelPath.setAttribute('type', 'hidden') + hiddenRelPath.setAttribute('name', 'relpermalink') + hiddenRelPath.value = relpermalink + dvm.prepend(hiddenRelPath) + var hiddenPath = document.createElement('input') hiddenPath.setAttribute('type', 'hidden') hiddenPath.setAttribute('name', 'relpath') hiddenPath.value = path dvm.prepend(hiddenPath) + var hiddenProtocol = document.createElement('input') hiddenProtocol.setAttribute('type', 'hidden') hiddenProtocol.setAttribute('name', 'protocol') hiddenProtocol.value = protocol dvm.prepend(hiddenProtocol) + Object.keys(frontmatter).forEach((fm)=>{ if (Array.isArray(frontmatter[fm])) { console.log("Array:", frontmatter[fm]) @@ -64,7 +73,7 @@ } path = repo.path; console.log(JSON.stringify(repo)) - generateFrontMatter(repo.frontmatter, path, document.location.protocol.substring(0,4)) + generateFrontMatter(repo.frontmatter, path, repo.relpermalink, document.location.protocol.substring(0,4)) } el.src = `../js/repo/${location.hash.substring(1)}.js` document.body.appendChild(el)