--- name: relayto-web-content description: Build a hand-made HTML page and publish it to RELAYTO as web content through the RELAYTO MCP server. Host its CSS, JS, fonts and images in the workspace's Workspace Files, write it so it renders correctly in RELAYTO's viewer (a shadow root under the toolbar) and stays editable in the web-content editor, link it to other RELAYTO contents (open a PDF in the viewer on a given page, in a lightbox, inside a hub), give it a thumbnail, create or update the content, and check it published and in the editor. Use it whenever you build, publish, update or debug a landing page, microsite, one-pager or interactive section that lives in RELAYTO, even if the request only says "put this page on RELAYTO", "upload my HTML", "make a RELAYTO landing page", "host the assets", "link the page to our documents" or "the page looks different in RELAYTO". license: Apache-2.0 metadata: publisher: RELAYTO homepage: https://relayto.com --- # Web content for RELAYTO A RELAYTO web content is one HTML page stored on a content and drawn by RELAYTO's viewer, with RELAYTO's toolbar, AI chat, analytics and editor around it. This skill is the whole path from an empty folder to a published, editable page. Editability itself (the component schema, the `data-rt-*` markers, the page script's contract with the editor) is the `relayto-web-components` skill: load it before writing markup, and follow it for every component. ## 0. Preflight - **The RELAYTO MCP server.** You need its tools (`createContent`, `uploadWorkspaceFile`, `listWorkspaceFiles`, `updateContentPages`, `createNewHub`…). If they are missing, stop and tell the user to connect `https://mcp.relayto.com/mcp` (sign-in with their RELAYTO account; in Claude it is the "RELAYTO AI" connector, in Claude Code `claude mcp add --transport http relayto https://mcp.relayto.com/mcp`). - **The workspace.** Decide it once and pass `workspace: ""` on every call, rather than switching the session with `selectWorkspace`: a page and its assets in two workspaces is the hardest mistake to notice. - **Admin rights.** `listWorkspaceFiles` returns `canManage`. Uploading Workspace Files is for workspace admins only. If `canManage` is false, stop and explain: the user needs a workspace admin to make them admin, or to run this for them. Do not fall back to inlining images or fonts into the HTML: the editor and the chat index both work through the stored HTML, and megabytes of base64 make both slow and fragile. ## 1. Lay out the files Work locally first, in a folder per page version: ``` / index.html the page: content and component markers only styles.css all CSS app.js all JS (one IIFE) assets/ images, logo, fonts (woff2) ``` In Workspace Files mirror it under one folder per page **version**, e.g. `pages///css/styles.css`, `…/js/app.js`, `…/img/…`, `…/fonts/…`. Overwriting a file keeps its URL and every page linking it picks up the new version, which is what you want while iterating on one version, and exactly what you don't want for an earlier version someone has already been sent. A new version gets a new folder. Lay the local folder out exactly like the version folder (`css/`, `js/`, `img/`, `fonts/` next to `index.html`), so `url(../fonts/…)` in the CSS resolves the same locally and published. Only the HTML needs absolute URLs when you publish: on RELAYTO it is served at `/e/`, where relative paths point nowhere. Keep CSS and JS in their own files rather than inline. The stored HTML is then only content and markers, which is what editors change in the editor, and a later restyle overwrites `styles.css` without touching HTML someone has edited. Link an empty `css/overrides.css` after `styles.css` from the start: every byte you upload passes through the conversation, and a QA fix is then a few lines instead of the whole stylesheet again. ## 2. Write the page for RELAYTO's viewer The viewer draws a full HTML document in a **shadow root** inside the app, under the RELAYTO toolbar, and runs its scripts in the app's own window against a stand-in `document` and `window`. Most pages just work. These rules cover the ones that don't: - **A full document.** Start with `……`. Only a full document gets the shadow-root renderer, in-app link routing and running scripts in the page; a fragment is put in an iframe instead. - **`html`, `body`, `:root`, `rem` and `@font-face` work.** The viewer points root selectors at stand-in elements, moves `@font-face` rules to the document (a shadow root ignores them) and rewrites `rem` when the page sets its own root font size. Linked stylesheets are fetched and inlined; their relative `url()`s resolve against the sheet. Workspace Files are served with `Access-Control-Allow-Origin: *`, so linking `styles.css` from there works. - **Don't size by the window.** `100vh` and `innerHeight` are the browser window, which is taller than the box the page scrolls in (the toolbar sits above it). A `100vh` hero overshoots and its bottom edge hides under the fold. Use `min-height: min(100svh - 64px, 920px)` or let content set the height. A design system that sizes its screens in `svh` can keep them and fit only the first screen to the box in the viewer: `[data-rt-html] .hero { height: calc(100svh - 64px); }` (`[data-rt-html]` is the viewer's stand-in for ``, so the rule never applies elsewhere). - **A fixed header pins to the page's box.** The viewer makes the box the containing block of `position: fixed`, so a fixed bar at `top: 0` sits under RELAYTO's 64 px bar (which also holds a hub's top bar), like a sticky one. Keep it one opaque bar; a sticky nav works the same way. - **Keep the top-right corner clear.** When the workspace has a call-to-action button ("Contact us"), RELAYTO floats it at the top right of the page's box on every screen, over the page's own header actions. Leave about 130 × 60 px free there (padding on the header bar), on phones too. - **Keep the bottom-right corner clear.** RELAYTO's floating controls (AI chat, CTA, fullscreen) sit there, and the proactive chat bubble opens there on desktop about 10 seconds after load. Don't put a primary action, a chart legend or the share price in the bottom-right 120 × 120 px of any screen-filling section. - **One IIFE, no globals.** Page globals land on the app's `window` and outlive the page. Wrap `app.js` in `(() => { … })();`, use `const`/`let`, and never rely on `document.write` or on a vendor script that finds itself through `document.currentScript` (embed snippets like TradingView's do: build their iframe yourself, see `references/embeds.md`). - **`#section` links scroll in the page.** The viewer catches a click on `href="#results"` and scrolls the box to the element with that id (less the page's `scroll-padding-top` and the target's `scroll-margin-top`, so a fixed nav's height works as usual). Scripts that read `location.hash` or build `#` URLs themselves see the app's address, not the page's: keep in-page navigation to plain `#id` links, or a `