Skip to content

Commit

Permalink
Fix sources and posts
Browse files Browse the repository at this point in the history
  • Loading branch information
Evgeny Kuzyakov committed Aug 3, 2023
1 parent a8ffd68 commit aab713a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 17 deletions.
2 changes: 1 addition & 1 deletion functions/sitemap/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export async function onRequest({ request, next, env }) {
return new Response(`<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://near.social/sitemap/posts/</loc>
<loc>https://near.social/sitemap/posts/0</loc>
</sitemap>
<sitemap>
<loc>https://near.social/sitemap/widgets/</loc>
Expand Down
8 changes: 0 additions & 8 deletions functions/sitemap/posts/index.js

This file was deleted.

18 changes: 10 additions & 8 deletions functions/sitemap/sources/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,19 @@ export const generateSitemapSources = async (env) => {
});
return Object.entries(data)
.map(([accountId, widget]) =>
Object.entries(widget.widget).map(([widgetId, blockHeights]) =>
blockHeights
.filter((blockHeight) => blockHeight >= MinBlockHeight)
.map(
(blockHeight) =>
` <url>
Object.entries(widget.widget)
.map(([widgetId, blockHeights]) =>
blockHeights
.filter((blockHeight) => blockHeight >= MinBlockHeight)
.map(
(blockHeight) =>
` <url>
<loc>https://near.social/mob.near/widget/WidgetSource?src=${accountId}/widget/${widgetId}&blockHeight=${blockHeight}</loc>
<changefreq>never</changefreq>
</url>`
)
)
)
)
.flat()
)
.flat()
.join("\n");
Expand Down

0 comments on commit aab713a

Please sign in to comment.