ai generated solutions to our ai generated problems
This commit is contained in:
@@ -84,6 +84,7 @@
|
|||||||
<meta name="twitter:image:alt" content="Toothless' TSS Bot share card" />
|
<meta name="twitter:image:alt" content="Toothless' TSS Bot share card" />
|
||||||
<link rel="icon" type="image/svg+xml" href="/embed-icon.svg" />
|
<link rel="icon" type="image/svg+xml" href="/embed-icon.svg" />
|
||||||
<link rel="apple-touch-icon" href="/embed-icon.svg" />
|
<link rel="apple-touch-icon" href="/embed-icon.svg" />
|
||||||
|
__TSS_PRELOAD_LINKS__
|
||||||
<script type="application/ld+json" id="site-structured-data">
|
<script type="application/ld+json" id="site-structured-data">
|
||||||
__SEO_JSON_LD__
|
__SEO_JSON_LD__
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
+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) {
|
function htmlWithSeo(req, data) {
|
||||||
const origin = pagePublicOrigin(req)
|
const origin = pagePublicOrigin(req)
|
||||||
let pathname = '/'
|
let pathname = '/'
|
||||||
@@ -2349,6 +2369,7 @@ function htmlWithSeo(req, data) {
|
|||||||
.replaceAll('__SEO_ROBOTS__', escapeHtml(seo.robots))
|
.replaceAll('__SEO_ROBOTS__', escapeHtml(seo.robots))
|
||||||
.replaceAll('__SEO_CANONICAL__', escapeHtml(canonicalUrl))
|
.replaceAll('__SEO_CANONICAL__', escapeHtml(canonicalUrl))
|
||||||
.replaceAll('__SEO_JSON_LD__', routeStructuredData(origin, seo, canonicalUrl).replace(/</g, '\\u003c'))
|
.replaceAll('__SEO_JSON_LD__', routeStructuredData(origin, seo, canonicalUrl).replace(/</g, '\\u003c'))
|
||||||
|
.replaceAll('__TSS_PRELOAD_LINKS__', routePreloadLinks(pathname))
|
||||||
.replaceAll('__TURNSTILE_SESSION__', isTurnstileSessionVerified(req) ? 'verified' : 'required')
|
.replaceAll('__TURNSTILE_SESSION__', isTurnstileSessionVerified(req) ? 'verified' : 'required')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user