diff --git a/src/routes/donation/+page.svelte b/src/routes/donation/+page.svelte index 7b80ec65..40668490 100644 --- a/src/routes/donation/+page.svelte +++ b/src/routes/donation/+page.svelte @@ -79,7 +79,7 @@ let cloudFrontUrl = import.meta.env.VITE_IMAGE_URL;
- logo + logo
diff --git a/src/routes/sitemap.xml/+server.ts b/src/routes/sitemap.xml/+server.ts index 986db15f..7de5548c 100644 --- a/src/routes/sitemap.xml/+server.ts +++ b/src/routes/sitemap.xml/+server.ts @@ -1,153 +1,154 @@ -import { userRegion } from '$lib/store'; +import { userRegion } from "$lib/store"; -const usRegion = ['cle1','iad1','pdx1','sfo1']; +const usRegion = ["cle1", "iad1", "pdx1", "sfo1"]; let apiURL; let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; -userRegion.subscribe(value => { -if (usRegion.includes(value)) { - apiURL = import.meta.env.VITE_USEAST_API_URL; -} else { - apiURL = import.meta.env.VITE_EU_API_URL; -} +userRegion.subscribe((value) => { + if (usRegion.includes(value)) { + apiURL = import.meta.env.VITE_USEAST_API_URL; + } else { + apiURL = import.meta.env.VITE_EU_API_URL; + } }); - export const config = { - runtime: 'nodejs20.x', - }; - + runtime: "nodejs20.x", +}; const pages = [ - {title: "/"}, - {title: "/cramer-tracker"}, - {title: "/reddit-tracker"}, - {title: "/most-shorted-stocks"}, - {title: "/stocks"}, - {title: "/etf"}, - {title: "/crypto"}, - {title: "/etf/etf-providers"}, - {title: "/etf/new-launches"}, - {title: "/trending"}, - {title: "/price-alert"}, - {title: "/heatmaps"}, - {title: "/portfolio"}, - {title: "/newsletter"}, - {title: "/options-flow"}, - {title: "/options-zero-dte"}, - {title: "/ipos"}, - {title: "/list"}, - {title: "/list/mega-cap-stocks"}, - {title: "/list/large-cap-stocks"}, - {title: "/list/mid-cap-stocks"}, - {title: "/list/small-cap-stocks"}, - {title: "/list/micro-cap-stocks"}, - {title: "/list/nano-cap-stocks"}, - {title: "/list/nasdaq-stocks"}, - {title: "/list/nyse-stocks"}, - {title: "/list/xetra-stocks"}, - {title: "/list/nasdaq-100-stocks"}, - {title: "/list/dow-jones-stocks"}, - {title: "/list/sp-500-stocks"}, - {title: "/list/canadian-stocks-us"}, - {title: "/list/chinese-stocks-us"}, - {title: "/list/indian-stocks-us"}, - {title: "/list/japanese-stocks-us"}, - {title: "/list/german-stocks-us"}, - {title: "/list/israeli-stocks-us"}, - {title: "/list/uk-stocks-us"}, - {title: "/list/financial-sector"}, - {title: "/list/healthcare-sector"}, - {title: "/list/technology-sector"}, - {title: "/list/industrials-sector"}, - {title: "/list/energy-sector"}, - {title: "/list/utilities-sector"}, - {title: "/list/consumer-cyclical-sector"}, - {title: "/list/real-estate-sector"}, - {title: "/list/basic-materials-sector"}, - {title: "/list/communication-services-sector"}, - {title: "/list/consumer-defensive-sector"}, - {title: "/list/delisted-stocks"}, - {title: "/list/bitcoin-etfs"}, - {title: "/stock-screener"}, - {title: "/market-news"}, - {title: "/market-news/crypto"}, - {title: "/market-news/general"}, - {title: "/earnings-calendar"}, - {title: "/economic-calendar"}, - {title: "/dividends-calendar"}, - {title: "/stock-splits-calendar"}, - {title: "/market-mover"}, - {title: "/community"}, - {title: "/community/create-post"}, - {title: "/hedge-funds"}, - {title: "/login"}, - {title: "/register"}, - {title: "/watchlist"}, - {title: "/leaderboard"}, - {title: "/tournament-rules"}, - {title: "/pricing"}, - {title: "/terms-of-use"}, - {title: "/privacy-policy"}, - {title: "/imprint"}, - {title: "/about"}, - {title: "/contact"}, - {title: "/blog"}, - {title: "/politicians"}, - {title: "/politicians/flow-data"}, - {title: "/analysts"}, - {title: "/analysts/top-stocks"}, - + { title: "/" }, + { title: "/cramer-tracker" }, + { title: "/reddit-tracker" }, + { title: "/corporate-lobbying-tracker" }, + { title: "/most-shorted-stocks" }, + { title: "/stocks" }, + { title: "/etf" }, + { title: "/crypto" }, + { title: "/etf/etf-providers" }, + { title: "/etf/new-launches" }, + { title: "/trending" }, + { title: "/price-alert" }, + { title: "/heatmaps" }, + { title: "/donation" }, + //{title: "/portfolio"}, + { title: "/newsletter" }, + { title: "/options-flow" }, + { title: "/options-zero-dte" }, + { title: "/ipos" }, + { title: "/list" }, + { title: "/list/dividend-kings" }, + { title: "/list/dividend-aristocrats" }, + { title: "/list/magnificent-seven" }, + { title: "/list/mega-cap-stocks" }, + { title: "/list/large-cap-stocks" }, + { title: "/list/mid-cap-stocks" }, + { title: "/list/small-cap-stocks" }, + { title: "/list/micro-cap-stocks" }, + { title: "/list/nano-cap-stocks" }, + { title: "/list/nasdaq-stocks" }, + { title: "/list/nyse-stocks" }, + { title: "/list/xetra-stocks" }, + { title: "/list/nasdaq-100-stocks" }, + { title: "/list/dow-jones-stocks" }, + { title: "/list/sp-500-stocks" }, + { title: "/list/canadian-stocks-us" }, + { title: "/list/chinese-stocks-us" }, + { title: "/list/indian-stocks-us" }, + { title: "/list/japanese-stocks-us" }, + { title: "/list/german-stocks-us" }, + { title: "/list/israeli-stocks-us" }, + { title: "/list/uk-stocks-us" }, + { title: "/list/financial-sector" }, + { title: "/list/healthcare-sector" }, + { title: "/list/technology-sector" }, + { title: "/list/industrials-sector" }, + { title: "/list/energy-sector" }, + { title: "/list/utilities-sector" }, + { title: "/list/consumer-cyclical-sector" }, + { title: "/list/real-estate-sector" }, + { title: "/list/basic-materials-sector" }, + { title: "/list/communication-services-sector" }, + { title: "/list/consumer-defensive-sector" }, + { title: "/list/delisted-stocks" }, + { title: "/list/bitcoin-etfs" }, + { title: "/stock-screener" }, + { title: "/market-news" }, + { title: "/market-news/crypto" }, + { title: "/market-news/general" }, + { title: "/earnings-calendar" }, + { title: "/economic-calendar" }, + { title: "/dividends-calendar" }, + { title: "/stock-splits-calendar" }, + { title: "/market-mover" }, + { title: "/community" }, + { title: "/community/create-post" }, + { title: "/hedge-funds" }, + { title: "/login" }, + { title: "/register" }, + { title: "/watchlist" }, + //{ title: "/leaderboard" }, + //{ title: "/tournament-rules" }, + { title: "/pricing" }, + { title: "/terms-of-use" }, + { title: "/privacy-policy" }, + { title: "/imprint" }, + { title: "/about" }, + { title: "/contact" }, + { title: "/blog" }, + { title: "/politicians" }, + { title: "/politicians/flow-data" }, + { title: "/analysts" }, + { title: "/analysts/top-stocks" }, ]; -const site = "https://stocknear.com" -const website = "https://stocknear.com" - +const site = "https://stocknear.com"; +const website = "https://stocknear.com"; /** @type {import('./$types').RequestHandler} */ -export async function GET({locals}) { +export async function GET({ locals }) { + //get all posts; + const outputPost = await locals.pb.collection("posts").getFullList(); - //get all posts; + const outputBlogPost = await locals.pb.collection("articles").getFullList(); - const outputPost = await locals.pb.collection('posts').getFullList() ; + const posts = outputPost?.map((item) => ({ + id: item.id, + })); - const outputBlogPost = await locals.pb.collection('articles').getFullList() ; + const articles = outputBlogPost?.map((item) => ({ + id: item.id, + })); - const posts = outputPost?.map(item => ({ - id: item.id, - })); + const rawData = await fetch(apiURL + "/searchbar-data", { + method: "GET", + headers: { + "Content-Type": "application/json", + "X-API-KEY": apiKey, + }, + }); + const outputStocks = await rawData.json(); + const stocks = outputStocks?.map((item) => ({ + id: item?.symbol, + type: item?.type, + })); - const articles = outputBlogPost?.map(item => ({ - id: item.id, - })); - - - const rawData = await fetch(apiURL+'/searchbar-data', { - method: 'GET', - headers: { - "Content-Type": "application/json","X-API-KEY": apiKey - }, - }); - - const outputStocks = await rawData.json(); - const stocks = outputStocks?.map(item => ({ - id: item?.symbol, - type: item?.type - })); - - - - const body = sitemap(posts, articles, stocks, pages); - const response = new Response(body); - response.headers.set('Cache-Control', 'max-age=0, s-maxage=3600'); - response.headers.set('Content-Type', 'application/xml'); - return response; + const body = sitemap(posts, articles, stocks, pages); + const response = new Response(body); + response.headers.set("Cache-Control", "max-age=0, s-maxage=3600"); + response.headers.set("Content-Type", "application/xml"); + return response; } // Modified sitemap function -const sitemap = (posts, articles, stocks, pages) => ` +const sitemap = ( + posts, + articles, + stocks, + pages +) => ` ` - ${pages.map((page) => ` + ${pages + .map( + (page) => ` ${website}${page.title} - `).join('')} - ${stocks.map((ticker) => { - // Determine the path based on the type of the ticker - const path = ticker.type === 'Stock' ? '/stocks/' : ticker.type === 'ETF' ? '/etf/' : '/stocks/'; - return ` + ` + ) + .join("")} + ${stocks + .map((ticker) => { + // Determine the path based on the type of the ticker + const path = + ticker.type === "Stock" + ? "/stocks/" + : ticker.type === "ETF" + ? "/etf/" + : "/stocks/"; + return ` ${website}${path}${ticker.id} `; - }).join('')} - ${articles.map((article) => ` + }) + .join("")} + ${articles + .map( + (article) => ` ${website}/blog/article/${article.id} - `).join('')} - ${posts.map((post) => ` + ` + ) + .join("")} + ${posts + .map( + (post) => ` ${website}/community/post/${post.id} - `).join('')} -`; \ No newline at end of file + ` + ) + .join("")} +`;