htdocs/template.js

27 lines
851 B
JavaScript
Raw Normal View History

2023-12-11 23:04:12 +01:00
let div = document.getElementById('main');
2023-12-11 23:45:30 +01:00
let divText = div.innerHTML;
2023-12-11 23:04:12 +01:00
console.log(divText);
let newPageHTML = `${pageTop}${divText}${pageBottom}`
2023-12-11 23:04:12 +01:00
document.body.innerHTML = newPageHTML
2023-12-29 23:24:45 +01:00
function goToLink(link) {
window.location.href = link
}
// Write latest blog to home page
let latestBlogDiv = document.getElementById("latestBlog");
let blogText = `<h5 class="blog-title"><a href="/blog/blogs/${blogs.length-1}.html">${blogs[blogs.length - 1][0]}</a></h5>
${blogs[blogs.length - 1][1]}
${blogs[blogs.length - 1][3] ?
`<div class="blog-images">
${blogs[blogs.length - 1][3].map(image => `<img class="blog-image" height="200" src="/images/${image}" alt="${image}" />`).join('')}
</div>`
: ''}`
let blogHTML = `${blogText}`
latestBlogDiv.innerHTML = blogHTML