From cde811f0df35cbad5850df2206395442398e6224 Mon Sep 17 00:00:00 2001 From: Bobby Date: Mon, 21 Mar 2022 05:53:09 -0400 Subject: update main page view --- public/views/index.html | 4 +--- routes/blog.js | 1 + routes/home.js | 24 +++++++++++++++++------- static/assets/js/pages/publish.js | 2 +- 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 @@
-

Hello, world!

-

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...

+
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(` -

${post.title}

+ $("#posts").append(` +
+

${post.title}

${post.shortText}

-

Read More

- `); - } +

Published On: ${new Date(post.publishDate).toLocaleString( + undefined, + { + weekday: "long", + year: "numeric", + month: "long", + day: "numeric", + } + )}

+

Read More

+
+ `); }); 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)) { -- cgit v1.2.3