update sitemap

This commit is contained in:
MuslemRahimi 2025-02-13 17:28:51 +01:00
parent 21dc432d05
commit 4e769888f9
5 changed files with 114 additions and 22 deletions

View File

@ -1,5 +1,11 @@
<script lang="ts">
import { stockTicker, etfTicker, indexTicker, setCache, getCache } from "$lib/store";
import {
stockTicker,
etfTicker,
indexTicker,
setCache,
getCache,
} from "$lib/store";
import { formatDate } from "$lib/utils";
import { page } from "$app/stores";
@ -39,9 +45,10 @@
}
try {
const url = new URL(link);
const result = (url.hostname === "www.youtube.com" || url.hostname === "youtube.com")
? url.searchParams.get("v")
: null;
const result =
url.hostname === "www.youtube.com" || url.hostname === "youtube.com"
? url.searchParams.get("v")
: null;
videoCheckCache.set(link, result);
return result;
} catch {
@ -61,10 +68,12 @@
// Optimize filtered list computation
$: filteredNewsList = (() => {
switch(displaySection) {
case 'videos':
return newsList.filter((item) => checkIfYoutubeVideo(item.url) !== null);
case 'press-releases':
switch (displaySection) {
case "videos":
return newsList.filter(
(item) => checkIfYoutubeVideo(item.url) !== null,
);
case "press-releases":
return rawDataPressRelease;
default:
return newsList;
@ -74,6 +83,12 @@
$: {
if ($stockTicker || $etfTicker || $indexTicker) {
rawData = data?.getNews || [];
if (rawData?.length > 0) {
rawData?.sort(
(a, b) => new Date(b?.publishedDate) - new Date(a?.publishedDate),
);
}
rawDataPressRelease = [];
newsList = rawData?.slice(0, 10) ?? [];
displaySection = "all";
@ -128,8 +143,7 @@
>
</li>
{/if}
{#if !["etf", "index"].some(sub => $page.url.pathname?.includes(sub))}
{#if !["etf", "index"].some( (sub) => $page.url.pathname?.includes(sub), )}
<li>
<button
on:click={() => getPressRelease()}

View File

@ -1,6 +1,4 @@
<script lang="ts">
import { numberOfUnreadNotification } from "$lib/store";
export let title;
export let description;
export let image;
@ -13,7 +11,6 @@
content="width=device-width, initial-scale=1.0, maximum-scale=1.0"
/>
<title>
{$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ""}
{title} - Stocknear
</title>

View File

@ -13,6 +13,7 @@ export const load = async ({locals}) => {
return output;
};
// Make sure to return a promise
return {
getAllBlogPost: await getAllBlogPost(),

View File

@ -0,0 +1,32 @@
export const load = async ({locals}) => {
const { pb } = locals;
const getBlogPosts = async () => {
// make the POST request to the endpoint
const output = await pb.collection("articles").getFullList({
sort: "-created",
}) || [];
return output?.slice(0,10);
};
const getTutorialPost = async () => {
// make the POST request to the endpoint
const output = await pb.collection("tutorials").getFullList({
sort: "-created",
}) || [];
return output?.slice(0,10);
};
// Make sure to return a promise
return {
getBlogPosts: await getBlogPosts(),
getTutorialPost: await getTutorialPost(),
};
};

View File

@ -1,7 +1,9 @@
<script>
import SEO from "$lib/components/SEO.svelte";
import ArrowLogo from "lucide-svelte/icons/move-up-right";
import { convertToSlug } from "$lib/utils";
export let data;
const tabs = [
{
title: "Stocks",
@ -182,9 +184,10 @@
];
</script>
<SEO title="Sitemap - Stocknear | Complete Financial Market Directory" description="Navigate through Stocknear's complete collection of financial tools and market analysis resources. Access real-time stock data, ETFs, options flow, and more." />
<SEO
title="Sitemap | Complete Financial Market Directory"
description="Navigate through Stocknear's complete collection of financial tools and market analysis resources. Access real-time stock data, ETFs, options flow, and more."
/>
<main>
<section
@ -200,7 +203,9 @@
<div class="w-full overflow-hidden m-auto mt-5">
<div class="sm:p-0 flex justify-center w-full m-auto overflow-hidden">
<div class="relative flex justify-center items-start overflow-hidden w-full">
<div
class="relative flex justify-center items-start overflow-hidden w-full"
>
<article class="w-full lg:w-3/4 lg:pr-10">
<div class="mb-6 border-b-[2px]">
<h1 class="mb-1 text-white text-2xl sm:text-3xl font-bold">
@ -211,20 +216,63 @@
<div class=" w-full bg-default m-auto text-white">
<div class="content">
<p class="text-[1rem] sm:text-lg">
Explore a comprehensive list of Stocknear's financial tools and resources. Find real-time stock data, market analysis, ETFs, options flow, and more. Use our search bar for quick access to specific stock symbols.
Explore a comprehensive list of Stocknear's financial tools
and resources. Find real-time stock data, market analysis,
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">Site Directory</h2>
<h2 class="text-white text-3xl font-semibold 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:columns-2 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-xl"
>
{#each tabs as item}
<li>
<a
class="sm:hover:underline sm:hover:underline-offset-4"
href={item?.link}
title={`Visit ${item?.title} page`}
>{item?.title}</a>
title={`Visit ${item?.title} page`}>{item?.title}</a
>
</li>
{/each}
</ul>
</nav>
<h2 class="text-white text-3xl font-semibold 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"
>
{#each data?.getBlogPosts 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}
</ul>
</nav>
<h2 class="text-white text-3xl font-semibold 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-xl"
>
{#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}
</ul>