-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
206 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,6 @@ out/ | |
build | ||
dist | ||
robots.txt | ||
sitemap*.xml | ||
analyze/ | ||
|
||
# misc | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { getAcademyArticles } from '@sushiswap/graph-client/strapi' | ||
import type { MetadataRoute } from 'next' | ||
|
||
const products = ['bentobox', 'furo', 'onsen', 'sushixswap'] | ||
|
||
export default async function sitemap(): Promise<MetadataRoute.Sitemap> { | ||
try { | ||
const { articles } = await getAcademyArticles({ | ||
pagination: { pageSize: 10000 }, | ||
}) | ||
|
||
return [ | ||
{ | ||
url: 'https://sushi.com/academy', | ||
lastModified: new Date(), | ||
changeFrequency: 'yearly', | ||
}, | ||
{ | ||
url: 'https://sushi.com/academy/explore', | ||
lastModified: new Date(), | ||
changeFrequency: 'yearly', | ||
}, | ||
...products.map( | ||
(product) => | ||
({ | ||
url: `https://sushi.com/academy/products/${product}`, | ||
lastModified: new Date(), | ||
changeFrequency: 'yearly', | ||
}) as const, | ||
), | ||
...articles.map( | ||
(article) => | ||
({ | ||
url: `https://sushi.com/academy/${article.slug}`, | ||
lastModified: new Date(article.updatedAt), | ||
changeFrequency: 'weekly', | ||
}) as const, | ||
), | ||
] | ||
} catch { | ||
console.error('sitemap: Error fetching academy articles') | ||
return [] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { getBlogArticles } from '@sushiswap/graph-client/strapi' | ||
import type { MetadataRoute } from 'next' | ||
|
||
export default async function sitemap(): Promise<MetadataRoute.Sitemap> { | ||
try { | ||
const { articles } = await getBlogArticles({ | ||
pagination: { pageSize: 10000 }, | ||
}) | ||
|
||
return [ | ||
{ | ||
url: 'https://sushi.com/blog', | ||
lastModified: new Date(), | ||
changeFrequency: 'yearly', | ||
}, | ||
...articles.map( | ||
(article) => | ||
({ | ||
url: `https://sushi.com/blog/${article.slug}`, | ||
lastModified: new Date(article.updatedAt), | ||
changeFrequency: 'weekly', | ||
}) as const, | ||
), | ||
] | ||
} catch { | ||
console.error('sitemap: Error fetching blog articles') | ||
return [] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import type { MetadataRoute } from 'next' | ||
|
||
const aptosChainPaths = ['/pool', '/explore/pools', '/pool/add', '/swap'] | ||
|
||
export default function sitemap(): MetadataRoute.Sitemap { | ||
return aptosChainPaths.map( | ||
(path) => | ||
({ | ||
url: `https://sushi.com/aptos/${path}`, | ||
lastModified: new Date(), | ||
changeFrequency: 'weekly', | ||
}) as const, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import type { MetadataRoute } from 'next' | ||
|
||
const tronChainPaths = ['/pool', '/explore/pools', '/pool/add', '/swap'] | ||
|
||
export default function sitemap(): MetadataRoute.Sitemap { | ||
return tronChainPaths.map( | ||
(path) => | ||
({ | ||
url: `https://sushi.com/tron/${path}`, | ||
lastModified: new Date(), | ||
changeFrequency: 'weekly', | ||
}) as const, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export const legalPages = { | ||
['privacy-policy']: { title: 'Privacy Policy' }, | ||
['terms-of-service']: { title: 'Terms of Service' }, | ||
['cookie-policy']: { title: 'Cookie Policy' }, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import type { MetadataRoute } from 'next' | ||
import { legalPages } from './_config' | ||
|
||
export default function sitemap(): MetadataRoute.Sitemap { | ||
return Object.keys(legalPages).map( | ||
(page) => | ||
({ | ||
url: `https://sushi.com/legal/${page}`, | ||
lastModified: new Date(), | ||
changeFrequency: 'weekly', | ||
}) as const, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { MetadataRoute } from 'next' | ||
|
||
export default function robots(): MetadataRoute.Robots { | ||
return { | ||
rules: { | ||
userAgent: '*', | ||
allow: ['/'], | ||
}, | ||
sitemap: 'https://sushi.com/sitemap.xml', | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { CHAIN_IDS } from 'src/config' | ||
import { getNetworkKey } from 'src/lib/network' | ||
|
||
const networkKeys = [...CHAIN_IDS.map(getNetworkKey), 'aptos', 'tron'] | ||
|
||
const sitemapFiles = [ | ||
'/academy/sitemap.xml', | ||
'/blog/sitemap.xml', | ||
...networkKeys.map((key) => `/sitemap.xml/${key}`), | ||
'/legal/sitemap.xml', | ||
] | ||
|
||
const generateSitemapLink = (url: string) => | ||
`<sitemap><loc>https://sushi.com${url}</loc></sitemap>` | ||
|
||
export async function GET() { | ||
const sitemapIndexXML = `<?xml version="1.0" encoding="UTF-8"?> | ||
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> | ||
${sitemapFiles.map((file) => generateSitemapLink(file)).join('')} | ||
</sitemapindex>` | ||
|
||
return new Response(sitemapIndexXML, { | ||
headers: { 'Content-Type': 'text/xml' }, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { MetadataRoute } from 'next' | ||
import { CHAIN_IDS } from 'src/config' | ||
import { getNetworkKey } from 'src/lib/network' | ||
|
||
const evmChainPaths = [ | ||
'/migrate', | ||
'/pool', | ||
'/rewards', | ||
'/cross-chain-swap', | ||
'/dca', | ||
'/limit', | ||
'/swap', | ||
'/explore/pools', | ||
'/explore/smart-pools', | ||
'/pool/incentivize', | ||
'/pool/v2/add', | ||
'/pool/v3/add', | ||
'/pool/v3/fees', | ||
] | ||
|
||
export async function generateSitemaps() { | ||
return CHAIN_IDS.map((chainId) => ({ | ||
id: getNetworkKey(chainId), | ||
})) | ||
} | ||
|
||
export default function sitemap({ id }: { id: string }): MetadataRoute.Sitemap { | ||
return evmChainPaths.map( | ||
(path) => | ||
({ | ||
url: `https://sushi.com/${id}${path}`, | ||
lastModified: new Date(), | ||
changeFrequency: 'weekly', | ||
}) as const, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters