Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,12 @@ docs # All documentation files
* **`llms.txt`** — the index agents read first ([llmstxt.org](https://llmstxt.org/)), at `/docs/hyperformula/llms.txt` (served at https://handsontable.com/docs/hyperformula/llms.txt). It links to `llms-full.txt`, lists every page by title with a link to its `.md` companion (grouped into guides and API reference), and adds fixed links to the AI and agent resources and to the source and licensing pages. The page list comes from the same sources as `llms-full.txt`, so it can't fall out of date. Like `llms-full.txt`, it is not written to the domain root: `/llms.txt` there belongs to handsontable.com.
* **Page actions** — below the table of contents (the `PageSidebar` override in `src/components/`), every page offers Copy Markdown and View as Markdown (its `.md` companion), Ask AI about this page, Print this page, and Open in ChatGPT or Claude (a new conversation that starts by reading the page). On narrower screens, where that sidebar is hidden, the `PageTitle` override shows View as Markdown near the top of the page.
* **"Set up your coding agent" page** &mdash; [`guide/setup-coding-agent.md`](guide/setup-coding-agent.md) explains how to point Claude Code, Cursor, Copilot, and other agents at these machine-readable docs, and embeds the `<hf-coding-agent-wizard>` custom element (`src/scripts/coding-agent-wizard.mjs`): an interactive picker that shows the right setup instructions for the agent you choose.

## Social preview image

Starlight emits `og:title`, `og:description`, and a `summary_large_image` Twitter card for every page, but no image, so a docs link shared on LinkedIn, Slack, or X shows a blank card unless the site adds one. `SOCIAL_IMAGE` in `astro.config.mjs` names the image, and `socialImageHead()` turns it into the `og:image*` and `twitter:image*` entries in the Starlight `head`.

* **The image is the handsontable.com default card** (`https://handsontable.com/og/default.png`, 1200x630), which carries the HyperFormula mark. The docs have no card of their own. To use one, put it in `public/` and change `url`, `width`, `height`, and `alt` together.
* **The URL is absolute,** because crawlers don't resolve a relative `og:image`. A branch preview therefore shows the production image.
* **Every page gets the same image.** A page can override it with a `head` entry in its frontmatter: Starlight replaces a config `meta` tag that has the same `name` or `property`.
* **Nothing checks the tags automatically.** After changing them, open a page on the branch preview and confirm the `og:image` tags are there.
25 changes: 25 additions & 0 deletions docs/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,29 @@ const normalizeBase = (base) => `/${base.replace(/^\/+|\/+$/g, '')}/`.replace(/^
const base = normalizeBase(process.env.DOCS_BASE || buildConfig.base);
const hostname = process.env.DOCS_HOSTNAME || buildConfig.hostname;

/**
* The image that link previews show for every docs page. Starlight emits `og:title`, `og:description`, and
* `twitter:card=summary_large_image` by itself, but no image. This is the handsontable.com default card, which carries
* the HyperFormula mark. The URL is absolute because crawlers don't resolve a relative `og:image`, and `width` and
* `height` must match the file.
*/
const SOCIAL_IMAGE = {
url: 'https://handsontable.com/og/default.png',
width: 1200,
height: 630,
alt: 'Handsontable DataGrid and HyperFormula',
};

/** The Starlight `head` entries for {@link SOCIAL_IMAGE}. */
const socialImageHead = () => [
{ tag: 'meta', attrs: { property: 'og:image', content: SOCIAL_IMAGE.url } },
{ tag: 'meta', attrs: { property: 'og:image:width', content: String(SOCIAL_IMAGE.width) } },
{ tag: 'meta', attrs: { property: 'og:image:height', content: String(SOCIAL_IMAGE.height) } },
{ tag: 'meta', attrs: { property: 'og:image:alt', content: SOCIAL_IMAGE.alt } },
{ tag: 'meta', attrs: { name: 'twitter:image', content: SOCIAL_IMAGE.url } },
{ tag: 'meta', attrs: { name: 'twitter:image:alt', content: SOCIAL_IMAGE.alt } },
];

export default defineConfig({
site: hostname,
base,
Expand Down Expand Up @@ -101,6 +124,8 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
},
// Google Search Console
{ tag: 'meta', attrs: { name: 'google-site-verification', content: 'MZpSOa8SNvFLRRGwUQpYVZ78kIHQoPVdVbafHhJ_d4Q' } },
// Social preview image for link previews (LinkedIn, Slack, X). See README.md, "Social preview image".
...socialImageHead(),
// Sentry
{
tag: 'script',
Expand Down
Loading