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