Finalize links page
This commit is contained in:
parent
c474ea4d75
commit
37295bacfe
8 changed files with 89 additions and 52 deletions
|
|
@ -6,13 +6,21 @@ function populate_links() {
|
|||
links.innerHTML = ''
|
||||
const item = document.createElement('li')
|
||||
const anchor = document.createElement('a')
|
||||
const date = document.createElement('span')
|
||||
anchor.innerText = link.title
|
||||
anchor.href = link.url
|
||||
date.innerText = `${parse_date(link.date)} - `
|
||||
item.appendChild(date)
|
||||
item.appendChild(anchor)
|
||||
links.appendChild(item)
|
||||
})
|
||||
}
|
||||
|
||||
function parse_date(date) {
|
||||
current_year = new Date().getFullYear()
|
||||
return date.replace(`/${current_year}`, '')
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
populate_links()
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue