From ece0f56d29509685f9b61642056f15f84a8a0726 Mon Sep 17 00:00:00 2001 From: Matthew Kosarek Date: Wed, 1 May 2024 14:12:17 -0400 Subject: cleanup: quick update, removing outdated items --- _posts/processPosts.js | 144 ------------------------------------------------- 1 file changed, 144 deletions(-) delete mode 100644 _posts/processPosts.js (limited to '_posts/processPosts.js') diff --git a/_posts/processPosts.js b/_posts/processPosts.js deleted file mode 100644 index 2bd6ff1..0000000 --- a/_posts/processPosts.js +++ /dev/null @@ -1,144 +0,0 @@ - - -const fs = require('fs'); -const path = require('path'); -const posts = require('./postList'); - -const tags = [ - { - id: 'personal', - title: 'Personal 👨' - }, - { - id: 'programming', - title: 'Programming 💻' - }, - { - id: 'books', - title: 'Books 📖' - }, - { - id: 'food', - title: 'Food 🍲' - } -] - -function createTagFile(tag) { - const dir = path.resolve(path.join(__dirname, '..', 'posts')); - - if (!fs.existsSync(dir)) { - fs.mkdirSync(dir); - } - - - const tagFileName = `tag_${tag.id}.html` - createPostPage(path.join(__dirname, '..', 'posts', tagFileName), tag.id) - return `/posts/${tagFileName}`; -} - -function createTag(tag) { - return ` - - `; -} - -function createPostServableFile(post) { - const dir = path.resolve(path.join(__dirname, '..', 'posts')); - - if (!fs.existsSync(dir)) { - fs.mkdirSync(dir); - } - - const baseFilePath = path.join(__dirname, '..', post.url); - const stats = fs.statSync(baseFilePath); - const content = fs.readFileSync(baseFilePath); - const fileName = post.url.substring(post.url.lastIndexOf('/') + 1); - const filePath = path.join(dir, fileName); - fs.writeFileSync(filePath,` - - - - - - - - Matthew Kosarek - - - -
-

Matthew Kosarek

- -
- -
-

${post.title}

-

Created ${stats.birthtime.toLocaleString()}. Last updated: ${stats.mtime.toLocaleString()}

- ${content} -
- - - `) - return '/posts/' + fileName; -} - -function createPostLink(post) { - return ` -
  • ${post.title}
  • - `; -} - -function createPostPage(outputFile, postFilter) { - const output = ` - - - - - - - - Matthew Kosarek - - - -
    -

    Matthew Kosarek

    - -
    - - ${postFilter ? '' : `
    -

    Tags

    - -
    - ${tags.map(createTag).join('\n')} -
    - -

    Posts

    - -
    - - -` - - fs.writeFileSync(outputFile, output); -} - -createPostPage(path.join(__dirname, '..', 'posts.html')); -- cgit v1.2.1