A calm place to write long-form, and publish it to the open social web. skypress.blog/
0

Configure Feed

Select the types of activity you want to include in your feed.

Add global 404 page for SP12

+31
+12
src/pages/404.astro
··· 1 + --- 2 + import ErrorScene from '../components/ErrorScene.astro'; 3 + import { errorScene } from '../lib/reader/errors'; 4 + 5 + // Generic, data-free: prerender to a static 404.html the adapter serves for 6 + // any unmatched URL. 7 + export const prerender = true; 8 + 9 + const scene = errorScene( 'not-found' ); 10 + --- 11 + 12 + <ErrorScene eyebrow={scene.eyebrow} heading={scene.heading} subline={scene.subline} />
+19
src/pages/404.meta.test.ts
··· 1 + import { readFileSync } from 'node:fs'; 2 + import { dirname, join } from 'node:path'; 3 + import { fileURLToPath } from 'node:url'; 4 + import { describe, expect, it } from 'vitest'; 5 + 6 + const here = dirname( fileURLToPath( import.meta.url ) ); 7 + const page = readFileSync( join( here, './404.astro' ), 'utf8' ); 8 + 9 + describe( 'global 404 page', () => { 10 + it( 'is prerendered (static, no per-request data)', () => { 11 + expect( page ).toMatch( /export const prerender = true/ ); 12 + } ); 13 + 14 + it( 'renders ErrorScene with the generic not-found copy', () => { 15 + expect( page ).toMatch( /import ErrorScene from '[^']*components\/ErrorScene.astro'/ ); 16 + expect( page ).toMatch( /errorScene\(\s*'not-found'\s*\)/ ); 17 + expect( page ).toMatch( /<ErrorScene/ ); 18 + } ); 19 + } );