change from mtime to dateCreated
This commit is contained in:
parent
32d6465bf9
commit
aed95beea1
5
app.js
5
app.js
@ -84,10 +84,10 @@ function getAllBlogPosts(page = 1, postsPerPage = 5) {
|
|||||||
|
|
||||||
// Get the last modified date of the markdown file
|
// Get the last modified date of the markdown file
|
||||||
const stats = fs.statSync(path.join(__dirname, 'markdown', file));
|
const stats = fs.statSync(path.join(__dirname, 'markdown', file));
|
||||||
const lastModifiedDate = new Date(stats.mtime); // Use mtime for last modification time
|
const dateCreated = new Date(stats.birthtime); // Use mtime for last modification time
|
||||||
|
|
||||||
// Format the date
|
// Format the date
|
||||||
const formattedDate = lastModifiedDate.toLocaleDateString('en-US', {
|
const formattedDate = dateCreated.toLocaleDateString('en-US', {
|
||||||
year: 'numeric',
|
year: 'numeric',
|
||||||
month: 'long',
|
month: 'long',
|
||||||
day: 'numeric'
|
day: 'numeric'
|
||||||
@ -270,7 +270,6 @@ app.get('/sitemap.xml', (req, res) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// RSS Feed Route
|
|
||||||
// RSS Feed Route
|
// RSS Feed Route
|
||||||
app.get('/rss', (req, res) => {
|
app.get('/rss', (req, res) => {
|
||||||
const hostname = req.headers.host || 'http://localhost'; // Adjust for production if needed
|
const hostname = req.headers.host || 'http://localhost'; // Adjust for production if needed
|
||||||
|
Loading…
Reference in New Issue
Block a user