Fix for longer numbers

This commit is contained in:
Bingus_Violet 2024-01-05 16:18:02 -06:00
parent fbb50c6cbe
commit bdf6a22857

View file

@ -41,7 +41,7 @@ function pageUpdate() {
var addedHTML = ""
var post = postsArray[i]
addedHTML += `<h2><a href="./post/${post}">${post.substring(4, post.length - 3)}</h2></a>`
addedHTML += `<h2><a href="./post/${post}">${post.substring(post.indexOf("]") + 2, post.length - 3)}</h2></a>`
html += addedHTML
}
@ -58,13 +58,14 @@ watcher
app.get('/post/:post*', (req, res) => {
var post = fs.readFileSync(path.join(postsPath, req.params.post)).toString()
var postName = req.params.post
post = mkthtml.makeHtml(post)
var html = fs.readFileSync(path.join(__dirname, 'resources/postPage.html')).toString()
html = html.replace('{POST}', post)
html = html.replace('{POST_TITLE}', req.params.post.substring(3, req.params.post.length - 3))
html = html.replace('{POST_TITLE}', postName.substring(postName.indexOf("]") + 2, postName.length - 3))
res.send(html)
})