Fix for longer numbers
This commit is contained in:
parent
fbb50c6cbe
commit
bdf6a22857
1 changed files with 3 additions and 2 deletions
5
index.js
5
index.js
|
@ -41,7 +41,7 @@ function pageUpdate() {
|
||||||
var addedHTML = ""
|
var addedHTML = ""
|
||||||
var post = postsArray[i]
|
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
|
html += addedHTML
|
||||||
}
|
}
|
||||||
|
@ -58,13 +58,14 @@ watcher
|
||||||
|
|
||||||
app.get('/post/:post*', (req, res) => {
|
app.get('/post/:post*', (req, res) => {
|
||||||
var post = fs.readFileSync(path.join(postsPath, req.params.post)).toString()
|
var post = fs.readFileSync(path.join(postsPath, req.params.post)).toString()
|
||||||
|
var postName = req.params.post
|
||||||
|
|
||||||
post = mkthtml.makeHtml(post)
|
post = mkthtml.makeHtml(post)
|
||||||
|
|
||||||
var html = fs.readFileSync(path.join(__dirname, 'resources/postPage.html')).toString()
|
var html = fs.readFileSync(path.join(__dirname, 'resources/postPage.html')).toString()
|
||||||
|
|
||||||
html = html.replace('{POST}', post)
|
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)
|
res.send(html)
|
||||||
})
|
})
|
Loading…
Reference in a new issue