ReviewOS

also looking at this

stacks/lastsoulultra

LSU's own coaching surface, and what auditing the site turned up

#12
Merged glennmichael123 wants to merge claude/last-soul-ultra-web-6e0718 into main
86 files +3943 -1190

Review threads live on the whole diff, not on one commit, so none are shown here - a thread's line means something in the branch's final form, and painting it into an intermediate step would put it on code it is not about.

resources/views/404.stxmodified+9-3
Changes to resources/views/404.stx
@@ -2,10 +2,16 @@
22import { liveRaceState } from '../data/live'
33import { race } from '../data/race'
44
5const pageTitle = 'not found - Last Soul Ultra'
6const pageDescription = 'That page is not here.'
5/* The head partial reads `currentPage`. This page used to declare pageTitle,
6 pageDescription and noindex as loose names nothing looked at, so a 404
7 served the site's default title and description and invited indexing. */
8const currentPage = {
9 title: 'not found - Last Soul Ultra',
10 description: 'That page is not here.',
11 styles: ['/assets/styles/production/base.css'],
12 noindex: true,
13}
714const canonicalPath = '/404'
8const noindex = true
915const state = await liveRaceState()
1016</script>
1117<!DOCTYPE html>
tests/seo.test.tsmodified+31-1
Changes to tests/seo.test.ts
@@ -1,6 +1,7 @@
11import { describe, expect, it } from 'bun:test'
22import { readFileSync, readdirSync } from 'node:fs'
3import { join } from 'node:path'
3import { join, resolve } from 'node:path'
4import { processDirectives } from '@stacksjs/stx'
45import server from '../config/server'
56import { coachingPage } from '../resources/data/coaching'
67import { productionPages } from '../resources/data/production-pages'
@@ -128,4 +129,33 @@ describe('seo artefacts', () => {
128129 it('does not list the noindex 404 page', () => {
129130 expect(indexablePaths).not.toContain('/404')
130131 })
132
133 it('gives every view the one metadata object the head reads', () => {
134 // 404.stx used to declare pageTitle, pageDescription and noindex as loose
135 // names nothing looked at, so the page served the site's default title and
136 // description and did not carry its noindex.
137 for (const path of viewPaths()) {
138 const file = `resources/views${path === '/' ? '/index' : path}.stx`
139 expect(readFileSync(file, 'utf8')).toContain('const currentPage')
140 }
141 })
142})
143
144describe('the page that is not found', () => {
145 it('says so, and asks not to be indexed', async () => {
146 const path = resolve('resources/views/404.stx')
147 const html = await processDirectives(await Bun.file(path).text(), {}, path, {
148 enabled: true,
149 cache: false,
150 componentsDir: resolve('resources/components'),
151 layoutsDir: resolve('resources/layouts'),
152 partialsDir: resolve('resources/partials'),
153 }, new Set())
154
155 expect(html).toContain('<title>not found - Last Soul Ultra</title>')
156 expect(html).toContain('<meta name="robots" content="noindex,nofollow">')
157 expect(html).toContain('content="That page is not here."')
158 // Nothing crawls it, so it carries no graph.
159 expect(html).not.toContain('application/ld+json')
160 })
131161})