Skip to content

Add a site

A Retro Web site is a folder of React pages and one Site object. This guide makes news.retro.com.

Use a host under retro.com, or another made-up domain that can’t be mistaken for a real company’s. Check Names first: names of real products are not allowed.

apps/web/src/sites/news/
index.ts the Site object
HomePage.tsx one component per page
news.css

Copy an existing site’s layout if the site has a header and navigation: sites/support and sites/mail each have a *Layout.tsx.

A page is a React component that takes PageProps:

import { useEffect } from 'react';
import type { PageProps } from '../../ie/sites';
export function HomePage({ setTitle }: PageProps) {
useEffect(() => setTitle('Retro News'), [setTitle]);
return <main className="news">...</main>;
}

Links are ordinary <a href>. Internet Explorer catches them and navigates inside the window, so a link to http://news.retro.com/story/42 works like on a real site.

apps/web/src/sites/news/index.ts
import type { Site } from '../../ie/sites';
import { HomePage } from './HomePage';
import { StoryPage } from './StoryPage';
/** Retro News: headlines on the Retro Web. */
export const newsSite: Site = {
hosts: ['news.retro.com'],
pages: {
'/': { component: HomePage },
'/story/:id': { component: StoryPage },
},
search: [{ title: 'Retro News', address: 'http://news.retro.com/', words: ['news'] }],
};

Add newsSite to SITES in apps/web/src/ie/sites.ts.

  • A component test that renders each page with fake PageProps.
  • If the site needs server data, add the HTTP route or socket call first (The protocol), and a mock for demo mode.
  • Open http://news.retro.com in Retro Internet Explorer in demo mode.