From dd88c311caf93d6f8f82123f8a045a3ed82e9934 Mon Sep 17 00:00:00 2001
From: Tanner Heffner Comments:
- {item.ghMetadata.reactions.total_count} โฅ -
- {/if} diff --git a/src/lib/components/Reactions.svelte b/src/lib/components/Reactions.svelte deleted file mode 100644 index ae66bd0..0000000 --- a/src/lib/components/Reactions.svelte +++ /dev/null @@ -1,34 +0,0 @@ - - -{#if reactions.total_count > 0} - - {#each Object.keys(reactions) as reaction} - {#if Object.keys(emojiMap).includes(reaction) && reactions[reaction] > 0} - - {/if} - {/each} - -{/if} diff --git a/src/lib/content.js b/src/lib/content.js index 752dabc..c79b9c3 100644 --- a/src/lib/content.js +++ b/src/lib/content.js @@ -8,6 +8,7 @@ import { GH_PUBLISHED_TAGS, REPO_OWNER } from './siteConfig'; +import { slugify, readingTime } from './utils' import parse from 'parse-link-header'; import { remark } from 'remark'; import remarkParse from 'remark-parse'; @@ -32,31 +33,6 @@ const rehypePlugins = [ let allBlogposts = []; // let etag = null // todo - implmement etag header -/** - * @param {string | number} text - * @returns {string} - */ -function slugify(text) { - return text - .toString() // Cast to string (optional) - .normalize('NFKD') // The normalize() using NFKD method returns the Unicode Normalization Form of a given string. - .toLowerCase() // Convert the string to lowercase letters - .trim() // Remove whitespace from both sides of a string (optional) - .replace(/\s+/g, '-') // Replace spaces with hyphen - .replace(/[^\w-]+/g, '') // Remove all non-word chars - .replace(/--+/g, '-') // Replace multiple hyphen with single hyphen - .replace(/(^-|-$)/g, ''); // Remove leading or trailing hyphen -} - -/** - * @param {string} text - * @returns {string} - */ -function readingTime(text) { - let minutes = Math.ceil(text.trim().split(' ').length / 225); - return minutes > 1 ? `${minutes} minutes` : `${minutes} minute`; -} - export async function listContent() { // use a diff var so as to not have race conditions while fetching // TODO: make sure to handle this better when doing etags or cache restore @@ -243,6 +219,7 @@ function parseIssue(issue) { return { type: 'blog', // futureproof in case you want to add other types of content + issueNumber: issue.number, content, frontmatter: data, title, diff --git a/src/lib/utils.js b/src/lib/utils.js new file mode 100644 index 0000000..18587f6 --- /dev/null +++ b/src/lib/utils.js @@ -0,0 +1,24 @@ +/** + * @param {string} text + * @returns {string} + */ +export function readingTime(text) { + let minutes = Math.ceil(text.trim().split(' ').length / 225); + return minutes > 1 ? `${minutes} minutes` : `${minutes} minute`; +} + +/** + * @param {string | number} text + * @returns {string} + */ +export function slugify(text) { + return text + .toString() // Cast to string (optional) + .normalize('NFKD') // The normalize() using NFKD method returns the Unicode Normalization Form of a given string. + .toLowerCase() // Convert the string to lowercase letters + .trim() // Remove whitespace from both sides of a string (optional) + .replace(/\s+/g, '-') // Replace spaces with hyphen + .replace(/[^\w-]+/g, '') // Remove all non-word chars + .replace(/--+/g, '-') // Replace multiple hyphen with single hyphen + .replace(/(^-|-$)/g, ''); // Remove leading or trailing hyphen +} diff --git a/src/routes/(main)/[slug]/+page.svelte b/src/routes/(main)/[slug]/+page.svelte index fa06f6b..6542e2f 100644 --- a/src/routes/(main)/[slug]/+page.svelte +++ b/src/routes/(main)/[slug]/+page.svelte @@ -77,23 +77,9 @@ $: canonical = SITE_URL + $page.url.pathname;tjheffner
- - {json.ghMetadata.reactions.total_count} - {#if json.ghMetadata.reactions.total_count === 1}reaction{:else}reactions{/if} - + {#if json.ghMetadata.reactions.total_count > 0} + + {json.ghMetadata.reactions.total_count} + {#if json.ghMetadata.reactions.total_count === 1}reaction{:else}reactions{/if} + + {/if} {new Date(json.date).toISOString().slice(0, 10)}
diff --git a/src/routes/(main)/about/+page.svx b/src/routes/(main)/about/+page.svx index 50e3602..40801ea 100644 --- a/src/routes/(main)/about/+page.svx +++ b/src/routes/(main)/about/+page.svx @@ -5,6 +5,9 @@this site is perpetually under construction but coming along :)
+This site is perpetually under construction but coming along :)
-it's mostly a reminder of past work and a place for me to post recipes I like, with the occasional technical post or personal blog mixed in.
+
It's mostly a place for me to post recipes I like, with the occasional technical post or personal blog mixed in. Some work-related stuff can be found here too, but that's not what I want to talk about.
-
thanks for stopping by, check out the links that work
+Thanks for stopping by, check out the links that work โ๏ธ
๐ถ - Stove God Cooks, Nujabes, Fleetwood Mac
+๐ฟ - The Righteous Gemstones, Saltburn
+๐ - Thinking, Fast And Slow by Daniel Kahneman
+๐ฎ - Baldur's Gate 3, Monster Train, RDR2
+ +Last updated: Jan 12, 2024
+In no particular order...