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

View File

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

View File

@ -13,6 +13,7 @@ export const load = async ({locals}) => {
return output; return output;
}; };
// Make sure to return a promise // Make sure to return a promise
return { return {
getAllBlogPost: await getAllBlogPost(), 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> <script>
import SEO from "$lib/components/SEO.svelte"; import SEO from "$lib/components/SEO.svelte";
import ArrowLogo from "lucide-svelte/icons/move-up-right"; import ArrowLogo from "lucide-svelte/icons/move-up-right";
import { convertToSlug } from "$lib/utils";
export let data;
const tabs = [ const tabs = [
{ {
title: "Stocks", title: "Stocks",
@ -182,9 +184,10 @@
]; ];
</script> </script>
<SEO
title="Sitemap | Complete Financial Market Directory"
<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." /> 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> <main>
<section <section
@ -200,7 +203,9 @@
<div class="w-full overflow-hidden m-auto mt-5"> <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="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"> <article class="w-full lg:w-3/4 lg:pr-10">
<div class="mb-6 border-b-[2px]"> <div class="mb-6 border-b-[2px]">
<h1 class="mb-1 text-white text-2xl sm:text-3xl font-bold"> <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=" w-full bg-default m-auto text-white">
<div class="content"> <div class="content">
<p class="text-[1rem] sm:text-lg"> <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> </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"> <nav aria-label="Site Pages">
<ul <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} {#each tabs as item}
<li> <li>
<a <a
class="sm:hover:underline sm:hover:underline-offset-4" class="sm:hover:underline sm:hover:underline-offset-4"
href={item?.link} href={item?.link}
title={`Visit ${item?.title} page`} title={`Visit ${item?.title} page`}>{item?.title}</a
>{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> </li>
{/each} {/each}
</ul> </ul>