{title}
-
- Written {dt.toRelativeCalendar()} ({dt.toLocaleString(DateTime.DATE_FULL)})
+
@@ -65,7 +75,7 @@
repo="danbulant/design"
issue-term="pathname"
label="comment"
- theme="github-{$darkmode ? "dark" : "light"}"
+ theme="github-dark"
crossorigin="anonymous"
async>
@@ -166,7 +176,7 @@
@apply rounded-lg bg-dark-400/03 p-1 transition-colors duration-300;
}
:global(body .post-layout ul) {
- @apply list-disc list-inside;
+ @apply list-disc mx-4;
}
:global(body .post-layout ul li) {
@apply my-0.5;
diff --git a/src/routes/+error.svelte b/src/routes/+error.svelte
index 67c016c..b1c9821 100644
--- a/src/routes/+error.svelte
+++ b/src/routes/+error.svelte
@@ -29,7 +29,7 @@
diff --git a/src/routes/api/posts.json/+server.js b/src/routes/api/posts.json/+server.js
index 36b7850..27f588f 100644
--- a/src/routes/api/posts.json/+server.js
+++ b/src/routes/api/posts.json/+server.js
@@ -1,11 +1,8 @@
-/**
- * @type {import("@sveltejs/kit").RequestHandler}
- */
-export async function GET(req) {
- const allPostFiles = import.meta.glob('../../posts/**/*.md');
+import { json } from "@sveltejs/kit";
- const allPosts = (await Promise.all(
- Object.entries(allPostFiles).map(async ([path, resolver]) => {
+function loadAll(files) {
+ return Promise.all(
+ Object.entries(files).map(async ([path, resolver]) => {
const { metadata } = await resolver();
let postPath = path.slice(2, -3);
if(postPath.endsWith('/+page')) postPath = postPath.slice(0, -6);
@@ -14,17 +11,27 @@ export async function GET(req) {
path: postPath,
};
})
- )).filter(t => !t.draft);
+ )
+}
+
+/**
+ * @type {import("@sveltejs/kit").RequestHandler}
+ */
+export async function GET(req) {
+ const allPostFiles = import.meta.glob('../../posts/**/*.md');
+ const allNotesFiles = import.meta.glob('../../notes/**/*.md');
+
+ const allPosts = (await loadAll(allPostFiles)).filter(t => !t.draft);
+ const allNotes = (await loadAll(allNotesFiles));
allPosts.sort((a, b) => {
return new Date(b.date) - new Date(a.date)
});
- return new Response(JSON.stringify(allPosts.filter(t => new Date(t.date) < Date.now())), {
- headers: {
- 'Content-Type': 'application/json'
- }
- });
+ return json({
+ posts: allPosts.filter(t => new Date(t.date) < Date.now()),
+ notes: allNotes
+ })
}
export const prerender = true;
diff --git a/src/routes/notes/+page.js b/src/routes/notes/+page.js
new file mode 100644
index 0000000..396922f
--- /dev/null
+++ b/src/routes/notes/+page.js
@@ -0,0 +1,11 @@
+import { error } from '@sveltejs/kit';
+
+/** @type {import('./$types').PageLoad} */
+export async function load({ fetch }) {
+ const response = await fetch("/api/posts.json");
+ if(!response.ok) {
+ throw error(response.statusText, response.status);
+ }
+
+ return response.json();
+}
\ No newline at end of file
diff --git a/src/routes/notes/+page.svelte b/src/routes/notes/+page.svelte
new file mode 100644
index 0000000..5745125
--- /dev/null
+++ b/src/routes/notes/+page.svelte
@@ -0,0 +1,11 @@
+
+
+
+ {#if date}
+ Written {dt.toRelativeCalendar()} ({dt.toLocaleString(DateTime.DATE_FULL)})
+ {/if}
{#if dtu}
Updated {dtu.toRelativeCalendar()} ({dtu.toLocaleString(DateTime.DATE_FULL)})
{/if}
-
I'm sorry for that. If this is a repeated problem, try contacting me (me@danbulant.eu)
-
+
diff --git a/src/routes/+page.js b/src/routes/+page.js
index aefa6e2..fe8bee9 100644
--- a/src/routes/+page.js
+++ b/src/routes/+page.js
@@ -1,7 +1,5 @@
/** @type {import('./$types').PageLoad} */
export async function load({ fetch }) {
- return {
- posts: await fetch("/api/posts.json").then(t => t.json())
- };
+ return await fetch("/api/posts.json").then(t => t.json())
}
\ No newline at end of file
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index 668db7b..87c98fd 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -47,9 +47,12 @@
-
-
-
\ No newline at end of file
+Posts
- -
-
- Posts
-
-
-
-
- {#if !selectedTags.length || selectedTags.find(tag => posts[0].categories.includes(tag))}
-
-
-
- {/if} - - - {#each filteredPosts as post (post.title)} -
-
- Posts
-
-
-
- RSS
-
-
-
-
- {#if !selectedTags.length || selectedTags.find(tag => posts[0].categories.includes(tag))}
- - {/if} - - - {#each filteredPosts as post (post.title)} -
-
-
- {/each}
-
+
+
+
\ No newline at end of file
+
+
+ postsActive = true}>Posts
+ postsActive = false}>Notes
+
+
+ Posts
+
+
+
+
+ {#if !selectedTags.length || selectedTags.find(tag => posts[0].categories.includes(tag))}
+
+
+
+ {/if} + + + {#each filteredPosts as post (post.title)} +
+
+
+ Posts
+
+
+
+ RSS
+
+
+
+
+ {#if !selectedTags.length || selectedTags.find(tag => posts[0].categories.includes(tag))}
+ + {/if} + + + {#each filteredPosts as post (post.title)} +
+
+
+ {/each}
+
+
+Notes
+Collection of short notes, write-ups and not-yet-posts.
+ +-
+ {#each notes as note}
+
- + + {note.title} + + + {/each} +