From d768ad1704d48a47b77721119779b9bab85a45e6 Mon Sep 17 00:00:00 2001 From: Akis Date: Sun, 1 Jan 2023 20:50:51 +0200 Subject: [PATCH] final changes to blog --- src/lib/BlogCard/Meta.svelte | 2 +- src/lib/BlogCard/PostOuter.svelte | 8 ++++++++ src/lib/BlogCard/SingleWordLists.svelte | 3 ++- src/routes/blog/[title]/+page.svelte | 2 +- src/routes/blog/authors/+page.svelte | 2 +- src/routes/blog/authors/[author]/+page.server.ts | 8 +++++++- src/routes/blog/authors/[author]/+page.svelte | 2 +- src/routes/blog/tags/+page.svelte | 2 +- src/routes/blog/tags/[tag]/+page.server.ts | 8 +++++++- src/routes/blog/tags/[tag]/+page.svelte | 2 +- uno.config.ts | 8 +++++++- 11 files changed, 37 insertions(+), 10 deletions(-) diff --git a/src/lib/BlogCard/Meta.svelte b/src/lib/BlogCard/Meta.svelte index 01da437..e40f770 100644 --- a/src/lib/BlogCard/Meta.svelte +++ b/src/lib/BlogCard/Meta.svelte @@ -9,7 +9,7 @@
{#each post.tags as tag} - {tag.name} + {tag.name} {/each}
{/if} diff --git a/src/lib/BlogCard/PostOuter.svelte b/src/lib/BlogCard/PostOuter.svelte index 1178810..94f563c 100644 --- a/src/lib/BlogCard/PostOuter.svelte +++ b/src/lib/BlogCard/PostOuter.svelte @@ -1,3 +1,11 @@ + +
+ + {#if url} + View on Ghost + {/if}
\ No newline at end of file diff --git a/src/lib/BlogCard/SingleWordLists.svelte b/src/lib/BlogCard/SingleWordLists.svelte index b343f83..146857d 100644 --- a/src/lib/BlogCard/SingleWordLists.svelte +++ b/src/lib/BlogCard/SingleWordLists.svelte @@ -1,10 +1,11 @@
{#each items as item} - {item.name} + {item.name} {/each}
\ No newline at end of file diff --git a/src/routes/blog/[title]/+page.svelte b/src/routes/blog/[title]/+page.svelte index f3d748c..2233904 100644 --- a/src/routes/blog/[title]/+page.svelte +++ b/src/routes/blog/[title]/+page.svelte @@ -9,7 +9,7 @@ {data.post.title} | Project Segfault Blog - + diff --git a/src/routes/blog/authors/+page.svelte b/src/routes/blog/authors/+page.svelte index 2f948a2..7c4c8c9 100644 --- a/src/routes/blog/authors/+page.svelte +++ b/src/routes/blog/authors/+page.svelte @@ -11,5 +11,5 @@

Blog authors

- + diff --git a/src/routes/blog/authors/[author]/+page.server.ts b/src/routes/blog/authors/[author]/+page.server.ts index 101e1be..1857b5d 100644 --- a/src/routes/blog/authors/[author]/+page.server.ts +++ b/src/routes/blog/authors/[author]/+page.server.ts @@ -3,10 +3,16 @@ import fetchApi from "$lib/ghost"; export const load: PageServerLoad = async ({ params }) => { const data = await fetchApi("posts", "&filter=author:" + params.author); + + const authorsLoop = data.posts[0].authors.map((author: { slug: string; name: any; }) => { + if (author.slug === params.author) { + return author.name; + } + }); return { posts: data.posts, - authorName: params.author + authorName: authorsLoop.filter((tag: any) => tag !== undefined)[0] }; }; diff --git a/src/routes/blog/authors/[author]/+page.svelte b/src/routes/blog/authors/[author]/+page.svelte index 1ba5b88..5e7006a 100644 --- a/src/routes/blog/authors/[author]/+page.svelte +++ b/src/routes/blog/authors/[author]/+page.svelte @@ -9,7 +9,7 @@ Blog author {data.authorName} | Project Segfault Blog -

Blog author {data.authorName}

+

Blog author {data.authorName}

{#each data.posts as post} diff --git a/src/routes/blog/tags/+page.svelte b/src/routes/blog/tags/+page.svelte index 2ef3e5e..08c0b83 100644 --- a/src/routes/blog/tags/+page.svelte +++ b/src/routes/blog/tags/+page.svelte @@ -11,4 +11,4 @@

Blog tags

- \ No newline at end of file + \ No newline at end of file diff --git a/src/routes/blog/tags/[tag]/+page.server.ts b/src/routes/blog/tags/[tag]/+page.server.ts index 2c7820a..f4eac1c 100644 --- a/src/routes/blog/tags/[tag]/+page.server.ts +++ b/src/routes/blog/tags/[tag]/+page.server.ts @@ -4,8 +4,14 @@ import fetchApi from "$lib/ghost"; export const load: PageServerLoad = async ({ params }) => { const data = await fetchApi("posts", "&filter=tags:" + params.tag); + const tagsLoop = data.posts[0].tags.map((tag: { slug: string; name: any; }) => { + if (tag.slug === params.tag) { + return tag.name; + } + }); + return { posts: data.posts, - tagName: params.tag + tagName: tagsLoop.filter((tag: any) => tag !== undefined)[0] } }; \ No newline at end of file diff --git a/src/routes/blog/tags/[tag]/+page.svelte b/src/routes/blog/tags/[tag]/+page.svelte index ed8050d..27e9d83 100644 --- a/src/routes/blog/tags/[tag]/+page.svelte +++ b/src/routes/blog/tags/[tag]/+page.svelte @@ -9,7 +9,7 @@ Blog tag {data.tagName} | Project Segfault Blog -

Blog tag {data.tagName}

+

Blog tag {data.tagName}

{#each data.posts as post} diff --git a/uno.config.ts b/uno.config.ts index fa1933b..f3ff76a 100644 --- a/uno.config.ts +++ b/uno.config.ts @@ -14,7 +14,13 @@ export default defineConfig({ presets: [ presetIcons(), - presetTypography(), + presetTypography({ + cssExtend: { + "h1,h2,h3,h4,h5,h6": { + "font-weight": "800" + } + } + }), presetWind({ dark: "class" })