final changes to blog

This commit is contained in:
Akis 2023-01-01 20:50:51 +02:00
parent 9635a48051
commit d768ad1704
Signed by untrusted user: akis
GPG Key ID: 267BF5C6677944ED
11 changed files with 37 additions and 10 deletions

View File

@ -9,7 +9,7 @@
<div class="flex flex-row items-center gap-2"> <div class="flex flex-row items-center gap-2">
<div class="i-fa6-solid:tags" /> <div class="i-fa6-solid:tags" />
{#each post.tags as tag} {#each post.tags as tag}
<a href="/blog/tags/{tag.slug}" class="no-underline">{tag.name}</a> <a href="/blog/tags/{tag.slug}" class="no-underline bg-primary rounded-2 p-1">{tag.name}</a>
{/each} {/each}
</div> </div>
{/if} {/if}

View File

@ -1,3 +1,11 @@
<script lang="ts">
export let url: string = "";
</script>
<div class="flex flex-col gap-4 bg-secondary p-4 rounded-2"> <div class="flex flex-col gap-4 bg-secondary p-4 rounded-2">
<slot /> <slot />
{#if url}
<a href={url}>View on Ghost</a>
{/if}
</div> </div>

View File

@ -1,10 +1,11 @@
<script lang="ts"> <script lang="ts">
export let items: any; export let items: any;
export let name: string;
</script> </script>
<div class="flex flex-col gap-4"> <div class="flex flex-col gap-4">
{#each items as item} {#each items as item}
<a href="/blog/authors/{item.slug}" class="bg-secondary w-fit p-2 rounded-2 no-underline">{item.name}</a> <a href="/blog/{name}/{item.slug}" class="bg-secondary sm:w-md p-2 rounded-2 no-underline">{item.name}</a>
{/each} {/each}
</div> </div>

View File

@ -9,7 +9,7 @@
<title>{data.post.title} | Project Segfault Blog</title> <title>{data.post.title} | Project Segfault Blog</title>
</svelte:head> </svelte:head>
<PostOuter> <PostOuter url={data.post.url}>
<TitleWithBackButton {data} /> <TitleWithBackButton {data} />
<Meta post={data.post} /> <Meta post={data.post} />
<PostContent {data} /> <PostContent {data} />

View File

@ -11,5 +11,5 @@
<h1>Blog authors</h1> <h1>Blog authors</h1>
<SingleWordLists items={data.authors} /> <SingleWordLists items={data.authors} name="authors" />

View File

@ -3,10 +3,16 @@ import fetchApi from "$lib/ghost";
export const load: PageServerLoad = async ({ params }) => { export const load: PageServerLoad = async ({ params }) => {
const data = await fetchApi("posts", "&filter=author:" + params.author); 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 { return {
posts: data.posts, posts: data.posts,
authorName: params.author authorName: authorsLoop.filter((tag: any) => tag !== undefined)[0]
}; };
}; };

View File

@ -9,7 +9,7 @@
<title>Blog author {data.authorName} | Project Segfault Blog</title> <title>Blog author {data.authorName} | Project Segfault Blog</title>
</svelte:head> </svelte:head>
<h1>Blog author {data.authorName}</h1> <h1>Blog author <span class="text-accent">{data.authorName}</span></h1>
<PostsContainer> <PostsContainer>
{#each data.posts as post} {#each data.posts as post}

View File

@ -11,4 +11,4 @@
<h1>Blog tags</h1> <h1>Blog tags</h1>
<SingleWordLists items={data.tags} /> <SingleWordLists items={data.tags} name="tags" />

View File

@ -4,8 +4,14 @@ import fetchApi from "$lib/ghost";
export const load: PageServerLoad = async ({ params }) => { export const load: PageServerLoad = async ({ params }) => {
const data = await fetchApi("posts", "&filter=tags:" + params.tag); 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 { return {
posts: data.posts, posts: data.posts,
tagName: params.tag tagName: tagsLoop.filter((tag: any) => tag !== undefined)[0]
} }
}; };

View File

@ -9,7 +9,7 @@
<title>Blog tag {data.tagName} | Project Segfault Blog</title> <title>Blog tag {data.tagName} | Project Segfault Blog</title>
</svelte:head> </svelte:head>
<h1>Blog tag {data.tagName}</h1> <h1>Blog tag <span class="text-accent">{data.tagName}</span></h1>
<PostsContainer> <PostsContainer>
{#each data.posts as post} {#each data.posts as post}

View File

@ -14,7 +14,13 @@ export default defineConfig({
presets: [ presets: [
presetIcons(), presetIcons(),
presetTypography(), presetTypography({
cssExtend: {
"h1,h2,h3,h4,h5,h6": {
"font-weight": "800"
}
}
}),
presetWind({ presetWind({
dark: "class" dark: "class"
}) })