Skip to content

Commit ea9d94d

Browse files
committed
setup single post page
1 parent 5c6d3ce commit ea9d94d

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

public/js/main.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,10 @@ function genImageInHTML(markdown){
9191
}
9292
}
9393

94-
// EXAMPLE - FEED PAGE
94+
function getPost(url) {
95+
console.log(url)
96+
}
97+
9598
if ($('main').hasClass('feed') ) {
9699

97100
let feedType = $('main.feed').data('feed-type')
@@ -103,6 +106,10 @@ if ($('main').hasClass('feed') ) {
103106
}
104107
}
105108

109+
if ($('main').hasClass('single')) {
110+
let data = $('main').data()
111+
getPost(`/@${data.username}/${data.permlink}`)
112+
}
106113

107114

108115
if ($('main').hasClass('profile') ) {

routes/index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,14 @@ router.get('/@:username?', (req, res, next) => {
1818
});
1919
});
2020

21+
router.get('/@:username/:permlink', (req, res, next) => {
22+
let username = req.params.username
23+
let permlink = req.params.permlink
24+
console.log(username)
25+
res.render('single', {
26+
username: username,
27+
permlink: permlink
28+
});
29+
});
30+
2131
module.exports = router;

views/layout.pug

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ html
99
script(src="https://code.jquery.com/jquery-3.2.1.min.js"
1010
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
1111
crossorigin="anonymous")
12+
script(src="https://cdnjs.cloudflare.com/ajax/libs/showdown/1.8.6/showdown.min.js")
1213
script(src="https://cdn.steemjs.com/lib/latest/steem.min.js")
1314
script(src="/js/main.js")

views/single.pug

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
extends layout
2+
3+
block content
4+
include partials/nav
5+
6+
main.single(data-username=`${username}` data-permlink=`${permlink}`)
7+
h1 Profile
8+
h2 #{username}
9+
h2 #{permlink}

0 commit comments

Comments
 (0)