mirror of
https://github.com/sys-nyx/red-arch.git
synced 2025-05-06 08:45:31 -04:00
added results formnatting to search page
This commit is contained in:
parent
83e0580de9
commit
7083671bb5
1 changed files with 13 additions and 4 deletions
|
@ -12,11 +12,20 @@
|
||||||
let links = document.querySelector('.links')
|
let links = document.querySelector('.links')
|
||||||
links.innerHTML = ''
|
links.innerHTML = ''
|
||||||
results.forEach(element => {
|
results.forEach(element => {
|
||||||
console.log(element.ref);
|
|
||||||
|
|
||||||
r = document.createElement('div')
|
d = document.createElement('div')
|
||||||
r.innerHTML = `<a href=${element.ref} class='link'>${element.ref}</a>`
|
d.classList.add('search-result')
|
||||||
links.appendChild(r)
|
t = document.createElement('a')
|
||||||
|
t.innerText = r.meta.title
|
||||||
|
t.href = r.meta.path
|
||||||
|
t.class = 'link'
|
||||||
|
|
||||||
|
p = document.createElement('p')
|
||||||
|
p.innerText = r.meta.body_short.replace(/[\n\r\t]/g, " ")
|
||||||
|
|
||||||
|
d.appendChild(t)
|
||||||
|
d.appendChild(p)
|
||||||
|
links.appendChild(d)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
searchWorker.onmessage = (e) => {
|
searchWorker.onmessage = (e) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue