ai generated solutions to our ai generated problems
This commit is contained in:
+21
@@ -2329,6 +2329,26 @@ function routeStructuredData(origin, seo, canonicalUrl) {
|
||||
])
|
||||
}
|
||||
|
||||
function routePreloadLinks(pathname) {
|
||||
const hrefs = []
|
||||
|
||||
if (pathname === '/') {
|
||||
hrefs.push('/api/tss/leaderboard/teams?limit=4')
|
||||
hrefs.push('/api/tss/games/recent?limit=50')
|
||||
} else if (pathname === '/teams') {
|
||||
hrefs.push('/api/tss/leaderboard/teams?limit=100')
|
||||
} else if (pathname === '/players') {
|
||||
hrefs.push('/api/tss/leaderboard/players?limit=100')
|
||||
} else if (pathname === '/battle-logs' || pathname === '/live') {
|
||||
hrefs.push('/api/tss/games/recent?limit=50')
|
||||
hrefs.push('/api/tss/leaderboard/teams?limit=100')
|
||||
}
|
||||
|
||||
return hrefs
|
||||
.map((href) => `<link rel="preload" as="fetch" href="${escapeHtml(href)}" type="application/json" fetchpriority="high" />`)
|
||||
.join('\n ')
|
||||
}
|
||||
|
||||
function htmlWithSeo(req, data) {
|
||||
const origin = pagePublicOrigin(req)
|
||||
let pathname = '/'
|
||||
@@ -2349,6 +2369,7 @@ function htmlWithSeo(req, data) {
|
||||
.replaceAll('__SEO_ROBOTS__', escapeHtml(seo.robots))
|
||||
.replaceAll('__SEO_CANONICAL__', escapeHtml(canonicalUrl))
|
||||
.replaceAll('__SEO_JSON_LD__', routeStructuredData(origin, seo, canonicalUrl).replace(/</g, '\\u003c'))
|
||||
.replaceAll('__TSS_PRELOAD_LINKS__', routePreloadLinks(pathname))
|
||||
.replaceAll('__TURNSTILE_SESSION__', isTurnstileSessionVerified(req) ? 'verified' : 'required')
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user