also looking at this
LSU's own coaching surface, and what auditing the site turned up
#12
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.
| @@ -2,10 +2,16 @@ | ||
| 2 | 2 | import { liveRaceState } from '../data/live' |
| 3 | 3 | import { race } from '../data/race' |
| 4 | 4 | |
| 5 | const pageTitle = 'not found - Last Soul Ultra' | |
| 6 | const 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. */ | |
| 8 | const 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 | } | |
| 7 | 14 | const canonicalPath = '/404' |
| 8 | const noindex = true | |
| 9 | 15 | const state = await liveRaceState() |
| 10 | 16 | </script> |
| 11 | 17 | <!DOCTYPE html> |
| @@ -1,6 +1,7 @@ | ||
| 1 | 1 | import { describe, expect, it } from 'bun:test' |
| 2 | 2 | import { readFileSync, readdirSync } from 'node:fs' |
| 3 | import { join } from 'node:path' | |
| 3 | import { join, resolve } from 'node:path' | |
| 4 | import { processDirectives } from '@stacksjs/stx' | |
| 4 | 5 | import server from '../config/server' |
| 5 | 6 | import { coachingPage } from '../resources/data/coaching' |
| 6 | 7 | import { productionPages } from '../resources/data/production-pages' |
| @@ -128,4 +129,33 @@ describe('seo artefacts', () => { | ||
| 128 | 129 | it('does not list the noindex 404 page', () => { |
| 129 | 130 | expect(indexablePaths).not.toContain('/404') |
| 130 | 131 | }) |
| 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 | ||
| 144 | describe('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 | }) | |
| 131 | 161 | }) |