Repository navigation
site: Give every page its own Open Graph card, and serve robots.txt - #24
Merged
Merged
Conversation
Every page may be crawled; the file points to the sitemap, which no file named until now, and to /llms.txt. Cloudflare puts its content signals in front of it, as it does today on its own. The image's smoke check that it goes out as UTF-8 text.
A link to any page now shows a 1200x630 card made for it when the site is built (/og/<page>.png): the crate's mark and name, the page's title and description in the dark theme and IBM Plex Sans, and a strip of an example's poster along the bottom. satori lays the card out and writes its text as paths, so the build needs no fonts installed, and sharp makes the PNG. The route middleware points og:image at the card, with its size and alt text; the 404 page has none. A page picks the poster with `poster` in its frontmatter (quotes when it names none): the demo pages keep the posters their hand-written og:image showed, Examples takes the desk and Performance the ops example. The site-wide social preview default goes; the picture stays for the repository's settings. The link checks hold every page to its card, a 1200x630 PNG, and the image's smoke check that the cards go out as PNG.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/og/<page>.png, 1200×630, made when the site is built (site/src/lib/og.ts,site/src/pages/og/[...slug].png.ts): the crate's mark and name, the page's title and description in the dark theme and IBM Plex Sans, and a strip of an example's poster along the bottom. satori lays the card out and writes its text as paths, so the build needs no fonts installed; sharp, which the site already uses, makes the PNG. The route middleware points each page'sog:imageat its card, withog:image:width,og:image:heightandog:image:alt; the 404 page has none.posterin the frontmatter (quotes by default). The three demo pages keep the posters their hand-writtenog:imageshowed; Examples takes the desk, Performance the ops example. The site-wide default from site: Add llms.txt, a link preview and a comparison of Rust data grids #23 goes;social-preview.pngstays for the repository's settings./robots.txt: every page may be crawled, with pointers to/sitemap-index.xmland/llms.txt. Today Cloudflare answers that path with its content signals alone, with no directives and no sitemap; it puts them in front of this file instead.New build dependency:
satori0.63.2 (MPL-2.0), used only to build the site.Checks
bun run --cwd site build,bun run --cwd site check(0 errors),bun test --cwd site(84 pass; the new check holds every page to its card, a 1200×630 PNG)docker/site/stage.sh,docker build,docker/site/smoke.sh: passed, with new checks for/robots.txt(UTF-8 text) and/og/index.png(image/png)typos