This commit is contained in:
MuslemRahimi 2025-02-12 17:12:35 +01:00
parent 1352c0a77a
commit efccac0ba4
3 changed files with 24 additions and 13 deletions

View File

@ -28,11 +28,10 @@
</h1> </h1>
</div> </div>
<div class="w-full grid grid-cols-1 sm:grid-cols-3 gap-y-5 sm:gap-y-0 sm:gap-5"> <div class="w-full grid grid-cols-1 sm:grid-cols-3 gap-y-5 gap-5">
{#if allBlogPosts?.length !== 0} {#if allBlogPosts?.length !== 0}
{#each allBlogPosts as item} {#each allBlogPosts as item}
<div <div
class="flex flex-col overflow-hidden rounded-lg shadow-lg sm:hover:shadow-2xl border border-gray-600" class="flex flex-col overflow-hidden rounded-lg shadow-lg sm:hover:shadow-2xl border border-gray-600"
> >
<div class="flex-shrink-0"> <div class="flex-shrink-0">
@ -56,7 +55,9 @@
<a <a
href={"/blog/article/" + convertToSlug(item?.title)} href={"/blog/article/" + convertToSlug(item?.title)}
class="mt-2 block" class="mt-2 block"
><h2 class="text-lg sm:text-xl font-semibold text-white"> ><h2
class="text-lg sm:text-xl font-semibold text-white"
>
{item?.title} {item?.title}
</h2> </h2>
<p class="mt-3 text-sm text-white"> <p class="mt-3 text-sm text-white">

View File

@ -18,8 +18,14 @@ export const load = async ({ locals, params }) => {
return matchingArticle; return matchingArticle;
}; };
const getParams = async() => {
return params?.slug
}
// Make sure to return a promise // Make sure to return a promise
return { return {
getArticle: await getArticle(), getArticle: await getArticle(),
getParams: await getParams(),
}; };
}; };

View File

@ -3,7 +3,13 @@
import SEO from "$lib/components/SEO.svelte"; import SEO from "$lib/components/SEO.svelte";
export let data; export let data;
const article = data?.getArticle; let article = data?.getArticle;
$: {
if (data?.getParams) {
article = data?.getArticle;
}
}
</script> </script>
<SEO <SEO
@ -25,8 +31,12 @@
<article <article
class="z-5 relative mx-1 -mt-10 rounded-t-md bg-default p-3 xs:p-4 lg:-mt-16 lg:ml-3 lg:p-5 xl:mx-4" class="z-5 relative mx-1 -mt-10 rounded-t-md bg-default p-3 xs:p-4 lg:-mt-16 lg:ml-3 lg:p-5 xl:mx-4"
> >
<header class="pb-3 border-b-[2px] border-white w-full sm:min-w-[850px] sm:max-w-[850px]"> <header
<h1 class="mb-3 text-2xl sm:text-3xl font-bold text-white md:text-4xl "> class="pb-3 border-b-[2px] border-white w-full sm:min-w-[850px] sm:max-w-[850px]"
>
<h1
class="mb-3 text-2xl sm:text-3xl font-bold text-white md:text-4xl"
>
{article?.title} {article?.title}
</h1> </h1>
<div class="text-white"> <div class="text-white">
@ -42,17 +52,11 @@
)} )}
</div> </div>
</div> </div>
</header> </header>
<div class="text-lg mt-4"> <div class="text-lg mt-4">
<div class="content"> <div class="content">
{@html article?.description} {@html article?.description}
</div> </div>
</div> </div>
</article> </article>
@ -71,7 +75,7 @@
</h4> </h4>
<p class="text-base text-white lg:text-lg"> <p class="text-base text-white lg:text-lg">
Get a daily email with the top market-moving news in bullet Get a daily email with the top market-moving news in bullet
point format, for free. point format, for Pro Members only.
</p> </p>
<div> <div>
<a <a