add blog post
This commit is contained in:
parent
19c29ba27e
commit
4b2ac9eea7
@ -8,6 +8,7 @@ export const load = async ({locals}) => {
|
|||||||
// make the POST request to the endpoint
|
// make the POST request to the endpoint
|
||||||
const output = await pb.collection("articles").getFullList({
|
const output = await pb.collection("articles").getFullList({
|
||||||
sort: "-created",
|
sort: "-created",
|
||||||
|
filter: "category='blog'"
|
||||||
});
|
});
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
|
|||||||
@ -15,21 +15,27 @@
|
|||||||
<SEO
|
<SEO
|
||||||
title={article?.title}
|
title={article?.title}
|
||||||
description={article?.abstract}
|
description={article?.abstract}
|
||||||
image={getImageURL(article?.collectionId, article?.id, article?.cover)}
|
image={article?.comver
|
||||||
|
? getImageURL(article?.collectionId, article?.id, article?.cover)
|
||||||
|
: ""}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<main id="main" class="mt-2 text-white min-h-screen pb-40">
|
<main id="main" class="mt-2 text-white min-h-screen pb-40">
|
||||||
<div class="mx-auto max-w-screen-xl">
|
<div class="mx-auto max-w-screen-xl">
|
||||||
<img
|
{#if article?.cover}
|
||||||
src={getImageURL(article?.collectionId, article?.id, article?.cover)}
|
<img
|
||||||
class="h-[200px] w-full object-cover lg:h-[350px]"
|
src={getImageURL(article?.collectionId, article?.id, article?.cover)}
|
||||||
loading="lazy"
|
class="h-[200px] w-full object-cover lg:h-[350px]"
|
||||||
alt="Wallpaper"
|
loading="lazy"
|
||||||
/>
|
alt="Wallpaper"
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
<div class="lg:flex">
|
<div class="lg:flex">
|
||||||
<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 {article?.cover
|
||||||
|
? '-mt-10 lg:-mt-16'
|
||||||
|
: 'mt-5'} rounded-t-md bg-default p-3 xs:p-4 lg:ml-3 lg:p-5 xl:mx-4"
|
||||||
>
|
>
|
||||||
<header
|
<header
|
||||||
class="pb-3 border-b-[2px] border-white w-full sm:min-w-[850px] sm:max-w-[850px]"
|
class="pb-3 border-b-[2px] border-white w-full sm:min-w-[850px] sm:max-w-[850px]"
|
||||||
|
|||||||
@ -98,7 +98,7 @@ export async function GET({ locals }) {
|
|||||||
sort: "-created",
|
sort: "-created",
|
||||||
});
|
});
|
||||||
|
|
||||||
const body = sitemap(stocks, articles, pages);
|
const body = sitemap(stocks, articles, pages, tutorials);
|
||||||
const response = new Response(body);
|
const response = new Response(body);
|
||||||
response.headers.set("Cache-Control", "max-age=0, s-maxage=3600");
|
response.headers.set("Cache-Control", "max-age=0, s-maxage=3600");
|
||||||
response.headers.set("Content-Type", "application/xml");
|
response.headers.set("Content-Type", "application/xml");
|
||||||
@ -110,6 +110,7 @@ const sitemap = (
|
|||||||
stocks,
|
stocks,
|
||||||
articles,
|
articles,
|
||||||
pages,
|
pages,
|
||||||
|
tutorials,
|
||||||
) => `<?xml version="1.0" encoding="UTF-8" ?>
|
) => `<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<urlset
|
<urlset
|
||||||
xmlns="https://www.sitemaps.org/schemas/sitemap/0.9"
|
xmlns="https://www.sitemaps.org/schemas/sitemap/0.9"
|
||||||
|
|||||||
@ -221,12 +221,12 @@
|
|||||||
ETFs, options flow, and more. Use our search bar for quick
|
ETFs, options flow, and more. Use our search bar for quick
|
||||||
access to specific stock symbols.
|
access to specific stock symbols.
|
||||||
</p>
|
</p>
|
||||||
<h2 class="text-white text-3xl font-semibold mt-8 mb-5">
|
<h2 class="text-white text-xl sm:text-2xl font-bold mt-8 mb-5">
|
||||||
Pages
|
Pages
|
||||||
</h2>
|
</h2>
|
||||||
<nav aria-label="Site Pages">
|
<nav aria-label="Site Pages">
|
||||||
<ul
|
<ul
|
||||||
class="list-outside list-disc space-y-1 p-1 pl-6 md:gap-x-8 md:text-xl"
|
class="list-outside list-disc space-y-1 p-1 pl-6 md:gap-x-8 md:text-lg"
|
||||||
>
|
>
|
||||||
{#each tabs as item}
|
{#each tabs as item}
|
||||||
<li>
|
<li>
|
||||||
@ -240,14 +240,35 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<h2 class="text-white text-3xl font-semibold mt-8 mb-5">
|
<h2 class="text-white text-xl sm:text-2xl font-bold mt-8 mb-5">
|
||||||
Articles
|
Articles
|
||||||
</h2>
|
</h2>
|
||||||
<nav aria-label="Site Pages">
|
<nav aria-label="Site Pages">
|
||||||
<ul
|
<ul
|
||||||
class="list-outside list-disc space-y-1 p-1 pl-6 md:gap-x-8 md:text-xl"
|
class="list-outside list-disc space-y-1 p-1 pl-6 md:gap-x-8 md:text-lg"
|
||||||
>
|
>
|
||||||
{#each data?.getBlogPosts as item}
|
{#each data?.getBlogPosts as item}
|
||||||
|
{#if item?.category === "blog"}
|
||||||
|
<li>
|
||||||
|
<a
|
||||||
|
href={"/blog/article/" + convertToSlug(item?.title)}
|
||||||
|
class="sm:hover:underline sm:hover:underline-offset-4"
|
||||||
|
title={`Visit ${item?.title} page`}>{item?.title}</a
|
||||||
|
>
|
||||||
|
</li>
|
||||||
|
{/if}
|
||||||
|
{/each}
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<h2 class="text-white text-xl sm:text-2xl font-bold mt-8 mb-5">
|
||||||
|
Learning Center
|
||||||
|
</h2>
|
||||||
|
<nav aria-label="Site Pages">
|
||||||
|
<ul
|
||||||
|
class="list-outside list-disc space-y-1 p-1 pl-6 md:gap-x-8 md:text-lg"
|
||||||
|
>
|
||||||
|
{#each data?.getTutorialPost as item}
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a
|
||||||
href={"/blog/article/" + convertToSlug(item?.title)}
|
href={"/blog/article/" + convertToSlug(item?.title)}
|
||||||
@ -259,21 +280,23 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<h2 class="text-white text-3xl font-semibold mt-8 mb-5">
|
<h2 class="text-white text-xl sm:text-2xl font-bold mt-8 mb-5">
|
||||||
Learning Center
|
Financial terms
|
||||||
</h2>
|
</h2>
|
||||||
<nav aria-label="Site Pages">
|
<nav aria-label="Site Pages">
|
||||||
<ul
|
<ul
|
||||||
class="list-outside list-disc space-y-1 p-1 pl-6 md:gap-x-8 md:text-xl"
|
class="list-outside list-disc space-y-1 p-1 pl-6 md:gap-x-8 md:text-lg"
|
||||||
>
|
>
|
||||||
{#each data?.getTutorialPost as item}
|
{#each data?.getBlogPosts as item}
|
||||||
<li>
|
{#if item?.category === "term"}
|
||||||
<a
|
<li>
|
||||||
href={"/blog/article/" + convertToSlug(item?.title)}
|
<a
|
||||||
class="sm:hover:underline sm:hover:underline-offset-4"
|
href={"/blog/article/" + convertToSlug(item?.title)}
|
||||||
title={`Visit ${item?.title} page`}>{item?.title}</a
|
class="sm:hover:underline sm:hover:underline-offset-4"
|
||||||
>
|
title={`Visit ${item?.title} page`}>{item?.title}</a
|
||||||
</li>
|
>
|
||||||
|
</li>
|
||||||
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user