Morrow is not a real railroad. This site is a demo project by Eugene Bednik: a block theme and a plugin of custom blocks, written to show how a site is put together with the WordPress block editor.
Everything you see is editable in the editor. There is no page builder and no PHP template: the header, the footer and every page layout are blocks. The source is on GitHub.
The theme
- Design tokens in one file. Colors, the type scale and spacing are set in theme.json, so the editor offers the same choices the design uses and nothing else.
- Section styles. The royal blue, navy and near-black bands are 3 style files for the Group block. An editor changes a section’s scheme with one click, and text and buttons inside follow.
- Patterns. Each section of the home page is a pattern that can be inserted on any page.
- A single typeface. Archivo, a variable font, in 3 widths: wide for places, condensed for times, regular for reading. The file is cut down to the characters the site uses.
- A second look. The site is dark by default. “Day service” is a style variation: the same site on a light page, chosen in the Site Editor.
The blocks
Departure board
The board on the home page. The server prints a complete board, so it works without JavaScript and the page can be cached. A small script on the Interactivity API then keeps the clock, lets you switch station or flip to arrivals, and turns only the flaps whose letter changed.
Journey
The line of stops on every route page. In the editor it is also where the stops are typed in. They are saved on the route, not in the block, because the departure boards and the facts at the top of the page read the same data. See its editor.
Ticket
A call to action shaped like a ticket. Its text is edited in place, and its button is the core Buttons block, so it keeps every control an editor already knows.
Where I did not build a block
The list of routes is the core Query Loop, registered as a variation. Each fact in a row (train, times, journey time, fare) is a plain paragraph bound to the route’s data through a block binding. The totals are bound the same way: the button under the list counts the routes itself, so its number changes when a route is published. The cabins and the questions are patterns of core blocks.
The data
A route is a post type with 4 fields: a train number, a fare, a distance and an ordered list of stops. Origin, destination, journey time and every station’s board are worked out from the stops by a single class with its own unit tests. Change a time on a route and the boards change with it. Times are stored on the 24-hour clock and printed in the format set under Settings, so the same data reads 8:10 PM here and 20:10 on a site set to the 24-hour clock.
Speed
- The home page first loads 5 requests and about 95 KB compressed, 56 KB of it the font. A route page, with its photograph, is 4 requests and about 190 KB.
- All styles are printed in the page. Each block’s styles are sent only on pages that use the block.
- A single font file is loaded, and it is preloaded. Fallback metrics keep the text from moving when it arrives.
- JavaScript is sent only where the board is, as a module that does not block the page.
- Photographs are sent as WebP, in the width that fits the screen. Those further down a page load when they are scrolled to. The board, the ticket and the journey line are drawn in CSS.
- Pages are served from a cache that is emptied when content changes.
Hosting
A single small container runs nginx, PHP and SQLite. It is built from the repository, so the theme, the plugin and this content are all in version control. The Dockerfile and the server configuration are in the repository too.
Every change goes through a pipeline on GitHub Actions: the blocks are linted and built, the timetable tests run, the container is built and tested from the outside, and a real browser opens every page. Only a change that passes all of it is deployed.
Photographs
The photographs are free to reuse: some are in the public domain (CC0), the others ask for a credit (CC BY). Each one was cropped and resized for this site and is shown in 2 tones of blue. The originals:
- Lower Manhattan at night by Michael Vadon, CC BY 2.0
- Atlanta at night by Chuck Koehler, CC BY 2.0
- Boston across the Charles River by Bill Damon, CC BY 2.0
- Richmond at dusk by Packer1028, CC0
- Cleveland from the Flats by Erik Drost, CC BY 2.0
- Raleigh beyond the tracks by Catherine from Brooklyn, NY, CC BY 2.0
- Detroit across the river by Michael Tighe, CC0
- Miami at sunrise by Euthman, CC BY 4.0
- Philadelphia and the Schuylkill at night by Andrew Parlette, CC BY 2.0
- Indianapolis at night by Chris Bowman, CC BY 2.0
- Breakfast tray by rawpixel, CC0
- Station clock by Candace McDaniel, CC0
- Duffel bag beside a chair by Erol Ahmed, CC0
- Trees passing a train window by Usamah Khan, CC0
- Rails at midnight after rain by Donnie Nunley, CC BY 3.0