Add a site
A Retro Web site is a folder of React pages and one Site
object. This guide makes news.retro.com.
1. Pick a host
Section titled “1. Pick a host”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.
2. Make the folder
Section titled “2. Make the folder”apps/web/src/sites/news/ index.ts the Site object HomePage.tsx one component per page news.cssCopy an existing site’s layout if the site has a header and navigation: sites/support and
sites/mail each have a *Layout.tsx.
3. Write the pages
Section titled “3. Write the pages”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.
4. Describe the site
Section titled “4. Describe the site”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'] }],};5. Register it
Section titled “5. Register it”Add newsSite to SITES in apps/web/src/ie/sites.ts.
6. Test it
Section titled “6. Test it”- 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.comin Retro Internet Explorer in demo mode.