From 3a9d4dd2fcb4805b7fd5b4ef2a1c0f5c629d7155 Mon Sep 17 00:00:00 2001 From: denizk0461 Date: Sat, 25 Apr 2026 12:14:14 +0200 Subject: [PATCH] moved feed post metadata out of individual posts to be more easily accessible --- src/routes/+page.svelte | 29 ++----- src/routes/feed/+page.svelte | 18 ++--- src/routes/feed/+page.ts | 35 ++++---- .../feed/electronics/nintendo-repairs.md | 25 ------ src/routes/feed/electronics/trans-phone.md | 17 ---- src/routes/feed/feed.ts | 80 +++++++++++++++++-- 6 files changed, 105 insertions(+), 99 deletions(-) diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 7afeab5..a2cbeac 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,34 +1,20 @@ @@ -123,7 +108,7 @@ { title: "Creative Feed", description: `the small things I make find a home here.`, - latestUpdate: latestFeedDate, + latestUpdate: getLatestPostDate(), img: "feed/banner.webp", altText: "A blue screen with the text 'how do you do art ? 1. face your fears 2. become your heroes'. The 'art' looks to have been edited in. The music artist Porter Robinson is standing in the bottom right corner.", link: "feed", @@ -193,7 +178,7 @@ gap: 16px; } - .button-container { + /* .button-container { flex: 2; } @@ -201,7 +186,7 @@ display: flex; flex-wrap: wrap; gap: 8px; - } + } */ .webring { display: flex; diff --git a/src/routes/feed/+page.svelte b/src/routes/feed/+page.svelte index 02f7ae3..15fcda3 100644 --- a/src/routes/feed/+page.svelte +++ b/src/routes/feed/+page.svelte @@ -46,16 +46,16 @@ {@render pageButtons(data.currentPage)} - {#each data.feedEntries as entry} -

{entry.title}

-

{entry.subtitle}

-

{entry.date}

- - {#if entry.images && entry.images.length > 0} + {#each data.feedPosts as post} +

{post.metadata.title}

+

{post.metadata.subtitle}

+

{post.metadata.date}

+ + {#if post.metadata.images && post.metadata.images.length > 0} diff --git a/src/routes/feed/+page.ts b/src/routes/feed/+page.ts index 37c56f5..52e0f93 100644 --- a/src/routes/feed/+page.ts +++ b/src/routes/feed/+page.ts @@ -1,13 +1,9 @@ -import { entries } from './feed'; +import { entries, type FeedEntry } from './feed'; -interface FeedEntry { +interface FeedPost { path: string; content: any; - title: string; - subtitle: string; - date: string; - images: string[]; - imageAlts: string[]; + metadata: FeedEntry; } let entriesPerPage = 8; @@ -21,7 +17,7 @@ export async function load({ params, url }) { // TODO check if index exceeds maximum permitted and redirect (to max page?) - let feedEntries: FeedEntry[] = []; + let feedPosts: FeedPost[] = []; let start = (pageIndex - 1) * entriesPerPage; for (let i = start; i < start + entriesPerPage; i += 1) { @@ -29,26 +25,23 @@ export async function load({ params, url }) { if (i >= entries.length) { break; } - let pathArray = entries[i].split("/"); + let e = entries[i]; + let pathArray = e.id.split("/"); let path = `./${pathArray[0]}/${pathArray[1]}`; // Vite complains if I don't do this even though it's stupid let page = await import(`./${pathArray[0]}/${pathArray[1]}.md`); let md = page.metadata; - let date = md.date; - // prevent SvelteKit from being smart and formatting a YYYY-MM-DD string to a Date object or similar - if ((date as string).endsWith("0Z")) { - date = date.split("T")[0]; - } + // let date = e.date; + // prevent SvelteKit from being 'smart' and formatting a YYYY-MM-DD string to a Date object or similar + // if ((date as string).endsWith("0Z")) { + // date = date.split("T")[0]; + // } - feedEntries.push({ + feedPosts.push({ path, content: page.default, - title: md.title, - subtitle: md.subtitle, - date: date, - images: md.images, - imageAlts: md.imageAlts, + metadata: e, }); } @@ -58,6 +51,6 @@ export async function load({ params, url }) { return { currentPage, maxPages, - feedEntries, + feedPosts, }; } \ No newline at end of file diff --git a/src/routes/feed/electronics/nintendo-repairs.md b/src/routes/feed/electronics/nintendo-repairs.md index d187247..24e1883 100644 --- a/src/routes/feed/electronics/nintendo-repairs.md +++ b/src/routes/feed/electronics/nintendo-repairs.md @@ -1,28 +1,3 @@ ---- -title: Nintendo Handheld Repairs -subtitle: it's been 8 years... -date: 2026-04-16 – 2026-04-23 -posted: 2026-04-24 -images: - - cardboard - - knifetoswitch - - 3dsopen - - thread - - threadsuccess - - 3dsfunctional -imageAlts: - - A Nintendo Switch with its back removed. The SD card reader connector is obstructed by a pink piece of cardboard. - - The SD card reader connector of a Nintendo Switch currently being stabbed with a knife in an attempt at repair. - - A 2011 Nintendo 3DS with its back covers removed on both the top and the bottom half. - - The hinge of a 3DS with some ribbon cables halfway pulled through. - - The hinge of a 3DS with three ribbon cables successfully pulled through. - - A functional 2011 Nintendo 3DS on the home screen, displaying the game "Zelda Four Swords Anniversary Edition" - # - The back of a Samsung Galaxy S20 FE lying face-down on a deskmat. Toothpicks, cotton pads, and a metal spudger are lying nearby. - # - A white phone back that's half-scratched off to reveal the clear plastic. - # - An entirely clear phone back. - # - A Samsung Galaxy S20 FE with a clear back inside a clear phone case. The phone has a sticker in the middle of the back that shows a lantern with leaves around it. ---- - I disassembled my Switch because I wanted to check whether the battery was swollen inside. It's had some battery issues (although they seem to have gone away lately). During reassembly, I put too much force on the SD card reader and broke it. Ordered a new part, replaced it, but turns out I broke the board-side connector too. It doesn't grip the ribbon cable like it should. Squishing some cardboard in there to keep the cable connected and level with the board helped. I was worried it would fail, but it's been a couple of days now and it still works flawlessly. Just in time, too; I started playing the new Tomodachi Life and need the storage for all the screenshots and videos I'm capturing. I also decided to tackle my 2011 3DS again. It broke in 2018: I was playing Super Mario Maker on the couch when it suddenly made a pop sound and turned off. When I disassembled it, I found that not only have I left the 3DS in a dismal state the last time I opened it -- most of the cables weren't even connected, not to mention the missing Y button, the removed battery due to swelling and the broken shoulder buttons --, but the ribbon cable connecting the speakers and top screen backlight had a *tear!* Finally, I knew what the problem may be! diff --git a/src/routes/feed/electronics/trans-phone.md b/src/routes/feed/electronics/trans-phone.md index 161d42f..0ceac3c 100644 --- a/src/routes/feed/electronics/trans-phone.md +++ b/src/routes/feed/electronics/trans-phone.md @@ -1,20 +1,3 @@ ---- -title: Transparent Phone Back -subtitle: nowhere to hide! -date: 2026-04-11 – 2026-04-12 -posted: 2026-04-12 -images: - - scratching - - halfway - - clear - - final -imageAlts: - - The back of a Samsung Galaxy S20 FE lying face-down on a deskmat. Toothpicks, cotton pads, and a metal spudger are lying nearby. - - A white phone back that's half-scratched off to reveal the clear plastic. - - An entirely clear phone back. - - A Samsung Galaxy S20 FE with a clear back inside a clear phone case. The phone has a sticker in the middle of the back that shows a lantern with leaves around it. ---- - Inspired by Nothing phones and cool dbrand skins from way back, I gave my phone a clear back mod! I've grown a bit tired of the white back and wanted to do something cool and unique instead of just buying a new back and sticking that on there. I've been using this phone for 5 years and the glue has been struggling hard to hold onto the back, so I didn't feel bad doing this. This was arduous and took a lot of time too (5 hours). I used a metal spudger, bamboo toothpicks, and cottons swabs and pads soaked in acetone-free nail polish remover to remove the two paint layers slowly but surely, being careful not to scratch the back too much. It revealed a slightly cloudly but actually decently transparent back that still preserved its slightly pearlescent purple glow! diff --git a/src/routes/feed/feed.ts b/src/routes/feed/feed.ts index 0a0d419..b61c7eb 100644 --- a/src/routes/feed/feed.ts +++ b/src/routes/feed/feed.ts @@ -1,8 +1,78 @@ -export let entries: string[] = [ - "electronics/nintendo-repairs", - "electronics/trans-phone", +export interface FeedEntry { + id: string; + title: string; + subtitle: string; + date: string; + posted: string; + images: FeedImage[]; +} + +interface FeedImage { + src: string; + alt: string; +} + +export let entries: FeedEntry[] = [ + { + id: "electronics/nintendo-repairs", + title: "Nintendo Handheld Repairs", + subtitle: "it's been 8 years...", + date: "2026-04-16 – 2026-04-23", + posted: "2026-04-24", + images: [ + { + src: "cardboard.webp", + alt: "A Nintendo Switch with its back removed. The SD card reader connector is obstructed by a pink piece of cardboard.", + }, + { + src: "knifetoswitch.webp", + alt: "The SD card reader connector of a Nintendo Switch currently being stabbed with a knife in an attempt at repair.", + }, + { + src: "3dsopen.webp", + alt: "A 2011 Nintendo 3DS with its back covers removed on both the top and the bottom half.", + }, + { + src: "thread.webp", + alt: "The hinge of a 3DS with some ribbon cables halfway pulled through.", + }, + { + src: "threadsuccess.webp", + alt: "The hinge of a 3DS with three ribbon cables successfully pulled through.", + }, + { + src: "3dsfunctional.webp", + alt: "A functional 2011 Nintendo 3DS on the home screen, displaying the game 'Zelda: Four Swords Anniversary Edition'", + }, + ], + }, + { + id: "electronics/trans-phone", + title: "Transparent Phone Back", + subtitle: "nowhere to hide!", + date: "2026-04-11 – 2026-04-12", + posted: "2026-04-12", + images: [ + { + src: "scratching.webp", + alt: "The back of a Samsung Galaxy S20 FE lying face-down on a deskmat. Toothpicks, cotton pads, and a metal spudger are lying nearby.", + }, + { + src: "halfway.webp", + alt: "A white phone back that's half-scratched off to reveal the clear plastic.", + }, + { + src: "clear.webp", + alt: "An entirely clear phone back.", + }, + { + src: "final.webp", + alt: "A Samsung Galaxy S20 FE with a clear back inside a clear phone case. The phone has a sticker in the middle of the back that shows a lantern with leaves around it.", + }, + ], + }, ]; -export function getLatestFeedItem(): Promise { - return import(`./${entries[0]}.md`); +export function getLatestPostDate(): string { + return entries[0].posted; } \ No newline at end of file