passing relpermalink so after edit it goes straight to the page...

This commit is contained in:
Marcell Mars 2021-03-28 01:38:03 +01:00
parent 0f8c43885b
commit 8386ab5dcf
1 changed files with 11 additions and 2 deletions

View File

@ -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)