aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--public/views/index.html4
-rw-r--r--routes/blog.js1
-rw-r--r--routes/home.js24
-rw-r--r--static/assets/js/pages/publish.js2
4 files changed, 20 insertions, 11 deletions
diff --git a/public/views/index.html b/public/views/index.html
index ad3b4d8..c9dde6e 100644
--- a/public/views/index.html
+++ b/public/views/index.html
@@ -36,9 +36,7 @@
<!-- Hero Unit -->
<div class="container margin-top-375" style="margin-top: 3.75rem;">
<div id="hero-unit" class="hero-unit hidden"></div>
- <h1>Hello, world!</h1>
- <p>I'm Bobby. Welcome to my personal website. Unfortunately, this website is currently under maintenance and I
- am working on a completely new look. Please come back soon...</p>
+ <div id="posts"></div>
</div>
<script src="/static/assets/js/jquery.js"></script>
<script src="/static/assets/js/bootstrap-386.js"></script>
diff --git a/routes/blog.js b/routes/blog.js
index 221aaf8..0c563a7 100644
--- a/routes/blog.js
+++ b/routes/blog.js
@@ -60,6 +60,7 @@ router.put("/update/:slug", (req, res) => {
content: post.content,
tags: post.tags,
publishDate: post.publishDate,
+ shortText: post.shortText,
});
});
})
diff --git a/routes/home.js b/routes/home.js
index 98309b6..414e2aa 100644
--- a/routes/home.js
+++ b/routes/home.js
@@ -24,14 +24,24 @@ router.get("/", (req, res) => {
var $ = cheerio.load(html);
$("#posts").html("");
posts.forEach((post, index) => {
- if (index === 0) {
- $('#hero-unit').removeClass('hidden');
- $('#hero-unit').html(`
- <h1>${post.title}</h1>
+ $("#posts").append(`
+ <div class="lead">
+ <h2>${post.title}</h2>
<p>${post.shortText}</p>
- <p><a class="btn btn-primary btn-lg" href="/posts/${post.slug}">Read More</a></p>
- `);
- }
+ <p>Published On: ${new Date(post.publishDate).toLocaleString(
+ undefined,
+ {
+ weekday: "long",
+ year: "numeric",
+ month: "long",
+ day: "numeric",
+ }
+ )}</p>
+ <p><a class="btn btn-default" href="/posts/${
+ post.slug
+ }">Read More</a></p>
+ </div>
+ `);
});
res.send($.html());
});
diff --git a/static/assets/js/pages/publish.js b/static/assets/js/pages/publish.js
index cc3c9c1..9f38828 100644
--- a/static/assets/js/pages/publish.js
+++ b/static/assets/js/pages/publish.js
@@ -48,7 +48,7 @@ $(document).on("click", "#publishPost", () => {
publishDate: publishDate,
tags: tags,
content: content,
- shortText: marked.parse(content.substring(0, 120) + "..."),
+ shortText: marked.parse(content.substring(0, 200) + "..."),
slug: slug,
};
if (window.location.href.includes(slug)) {