documentation/STATIC-SITE.md · main · 2026-11-14

Static Site

The static site is a website of the repository that gitsocial mirror and gitsocial push build in a bucket, as static files that the browser reads directly: timeline, issues and boards, pull requests, releases, code, search, analytics.

Mirror · Publish · Customization · HTML pages · Fork pull requests · Design · Testing · Reference

Mirror

For a project on a forge, one command clones the project, imports its issues, pull requests, releases and discussions, pushes data and code, and builds the site:

gitsocial mirror https://github.com/owner/repo s3://<endpoint>/<bucket>/<prefix> --url https://your-domain/
gitsocial mirror                       # later, from the workspace: refresh

Publish

gitsocial remote add s3://<endpoint>/<bucket>/<prefix>   # once, see S3.md
gitsocial config site set publish true
gitsocial push

Customization

gitsocial config site set <key> <value>    # or in the TUI under Configuration, Site
gitsocial config site list

Values are in the site object of the core config ref and reach the bucket as .gitsocial/site/site-config.json on the next push. A value that fails validation uses its default. The last four keys belong to the HTML pages.

KeyExampleValidation
title"My Project"plain string, trimmed, up to 200 characters
description"One sentence for search results"plain string, trimmed, up to 300 characters
accent, accentDark"#0a7"#rgb or #rrggbb
faviconfavicon.pngshown beside the sidebar title: a key relative to the site root (upload with gitsocial remote put) or an absolute https:// URL, up to 500 characters
imageog-card.pngog:image for every page: a key relative to the site root (upload with gitsocial remote put) or an absolute https:// URL, up to 500 characters
forkPullRequeststruetrue or false, default false; see Fork pull requests
objectStorefalsetrue or false, default true; the app keeps the git objects it read in the browser's Cache API
urlhttps://example.com/absolute https:// base (http:// for localhost only), no query or fragment, up to 500 characters
publish, pagestruetrue or false, both default false
filesInclude, filesExclude"internal/**"comma-separated repo-relative globs; ** spans segments; a leading / or a .. segment is dropped

Per-remote overrides

Only url, publish and pages can differ per remote; the other keys are the same for all remotes of the repository. An override is in the local git config as remote.<name>.gitsocial-site-<key>, rebuilds the full site of that remote on the next push, and applies to pushes by remote name, not by URL.

gitsocial config site set publish false --remote backup
gitsocial config site list --remote backup     # effective values

HTML pages

HTML pages are crawlable pages that a browser shows without JavaScript; with JavaScript on, a page starts the app in the same browser tab.

gitsocial config site set pages true
gitsocial config site set url "https://example.com/"   # absolute base for canonicals, OG tags and the sitemap

Effective when publish, pages and a valid url are all set. Every push then maintains:

What a page shows:

What a page leaves to the app:

On a large repository, several pushes can be necessary to write every page; GITSOCIAL_SITE_PAGES_BUDGET limits the item pages that one push writes (S3.md). Setting pages false or removing url deletes the pages on the next push.

File pages

The selection reads the tree of the default branch. A file is published when it passes each row, in this order.

RuleValue
Excluded firsta path with a space or one of @ : # ? % \ " < >, a submodule, a symlink, the root README, and a path that a filesExclude glob matches
Skipped directoriesa directory whose name starts with ., and node_modules, vendor, testdata, third_party, fixtures, golden, corpus, snapshots, __snapshots__, at any depth, case-insensitive
Markdown.md, .markdown, .mdown, .mdx, case-insensitive; rendered as markdown, front matter stripped, MDX import, export and component blocks dropped
Convention namesan extensionless file named, in any case, AUTHORS, CHANGELOG, CHANGES, CONTRIBUTING, CONTRIBUTORS, COPYING, INSTALL, MAINTAINERS, NOTICE, README, SECURITY, TODO, or a name that starts with LICEN; shown as preformatted text
Included by globany other file that a filesInclude glob matches; shown as preformatted text
Keythe extension swapped for .html, else .html appended: docs/A.md is f/docs/A.html, LICENSE is f/LICENSE.html; when two files map to one key, or to f/index.html, the later one by path takes f/<path>.html, and a third is skipped
Sizethe first 256 KiB of the source, cut at a line, with a truncation notice
Sitemapa page under 100 words carries noindex,follow and is not in the sitemap
Rewritea page is written again when its blob or key changes, when the default branch changes, and when a document is added or removed

A source file is not published by default. To publish one, add its glob to filesInclude, for example cmd/**/*.go; each matching file then gets a page under f/ with its source as text, and the file route of the app shows that page's URL.

Fork pull requests

gitsocial config site set forkPullRequests true

With publish and forkPullRequests set, each push writes the open pull requests of registered forks whose base is this repository under .gitsocial/forks/: one pack per head that gitsocial fetch brought, and a manifest. The app lists each one with a fork chip and the fork URL, and reads its pack when a reader opens it. A head not fetched yet, or one whose pack is over 32 MB, shows the pull request with a notice in place of the diff. Setting the key to false deletes the area on the next push. A lock key in the area, put with gitsocial remote put .gitsocial/forks/lock <file>, freezes it: the push writes and deletes nothing there and prints one note.

Design

The site is the app shell, the pre-rendered pages and the two stylesheets. Five rules hold across all three.

  1. Every page shows its content without JavaScript; the app adds to what the reader sees and never replaces it.
  2. The page layer and the app render a component from the same class names and the same tokens. Two markups for one component is a defect.
  3. Three faces, by role: sans to scan, the base of every page, its lists, cards and controls, and the author of a meta line; serif to read, the title and the text of an item on its own page and a document; small mono for the frame and the data, the page and view titles, the sidebar, the meta lines, the chips, the fields and the code. Two weights, regular and bold. Nothing is decorative.
  4. Every rule holds on any repository: no README, no issues, a tree of thousands of files, an .mdx documentation site.
  5. A missing asset or a failed fetch shows a one-line notice at the position of the content, never a blank or an endless spinner.

A card has the shape of a post in a feed, on both renderers:

  1. The avatar, in a mark column at the left, level with the author line: the initials of the author in a circle. The hue of the circle comes from the email of the author, so each card of one author has the same hue. A picture that the bucket holds under the avatar key of the email of the author fills the circle, and the initials are its alt text; gitsocial import avatars copies the pictures (CLI.md). A branch, list, board or feedback card has no avatar; a tag card has the avatar of its tagger.
  2. The type glyph, in the text color, under the avatar in the same column, or at the top of the column when the card has no avatar. The shape of the glyph shows the state of an issue, a milestone or a sprint. A commit has no glyph: a card with a face and no mark is a commit. A board tile has no glyph and no mark column. An item with no glyph keeps the column, empty.
  3. The author line: the author, the time, the hash and the markers, such as edited. A state other than open or planned, such as closed or merged, or a marker, such as draft, prerelease or retracted, is the last word of the line, and it replaces the edited marker. An action and a repost put the verb after the author: "Ada closed", "Ada reposted".
  4. One row of chips: the chips that name the item (the version of a release, the sub-issue count of an issue); then the counts, each only when it is not zero (comments, reposts, quotes and the latest verdict of each reviewer, on every card and every static entry, the assets of a release), and on a milestone or sprint the issue count, after the dates of a sprint; then the references (the original a reply, repost or quote names, the comment it replies to, the pull request of a feedback, the branch pair, the head and base tips, stacked, milestone, sprint, parent, closes, refs, blocks, blocked-by, related; the issues a merge closes on its action card); then the due date; then the facets (priority, assignees, reviewers, labels); then the provenance (origin, bot, the fork mark). Each chip has one kind of six, state, count, reference, facet, date or provenance, and the kind gives its class; one glyph at its start marks the kind or the target, and a label, a priority or a date has none. A reference takes the glyph of the type of its target, so the original of a comment on a sprint shows ◷, and a reference to a target of unknown type takes the glyph of its branch, the issue glyph for gitmsg/pm. A reference names the subject of its target, else its short hash; a card shows three chips per relation and a "+n" chip that opens the page, and a past due date on an open item takes the closed tint. A card with no chip has no row. The detail page and the item page show every chip of the same row under the meta line, and a field with a chip has no definition row: the rows are the merge base, the merge head, the commit of a feedback or release, and the fields no chip names. A feedback detail puts its verdict and anchor in the chip row, as its card does, and the edited marker and the thread carry the edits and root fields.
  5. The title of a titled item, alone on its line. A comment, quote or repost has no title.
  6. The excerpt, the body under a clamp of five lines, on every list, a search result included, or the text of a comment, quote or repost; until the body loads, a card shows the excerpt of its index entry, and a release headed by its tag leads its excerpt with its subject; then the quote box of a reply, a quote or a repost, which leads with a smaller avatar, the glyph and the author line of the quoted item. The glyph button at the right of a list heading switches every list to compact cards, which hide the excerpt, and back; the browser keeps one choice for all lists. Every other body takes the same clamp: a reply, a feedback and a quote box on an item page or a detail, and the text of a static entry. A fork pull request and a search result after the first 25 keep the excerpt of the index entry, because the bucket holds no fork body and search fills 25 bodies at a time. A branch, a tag, a board tile, a member row and a list row have no excerpt.

The bell in the sidebar header of the app opens the panel of browser notifications, on the panel surface and tokens of the sidebar; a generated page shows the bell when the app starts on it.

The tokens are declared once, in pages-core.css; site_pages_tokens_test.go fails on a spacing value off the scale or a token declared elsewhere. sitetest/parity_fixtures.json records the markup and wording that the page layer and the app share. A visual change includes its golden and baseline update in the same commit.

Testing

scripts/site-test.sh                                              # the browser battery
go test -tags sitetest -timeout 30m ./library/core/site/      # the same from go test; skipped without node
bin/locals3 -root <dir>                                           # serve a pushed site locally, see S3.md
GS_STYLES_UPDATE=1 node library/core/site/sitetest/verify_styles.js   # recapture the style baselines
go test -tags sitetest -run TestSiteShapeGoldens ./library/core/site/ -update   # regenerate the goldens

Reference

Page keys

The pages are at the prefix root, next to the shell; the cache classes are in S3.md.

KeyContentCache
index.htmlfront page while the page layer is on, otherwise the shell; its asset references carry the shell revisionno-cache
.gitsocial/site/gs-sw.jsthe service worker of browser notifications, at the same key for all shells, so a site has one registration; written before the index flipno-cache
.gitsocial/site/shell/<rev>/the shell assets of one binary version; the current and previous revisions are kept, older ones swept on a shell changeimmutable
i/<short>.htmlone page per top-level itemno-cache
issues/, prs/, posts/, releases/, memos/index.html head plus full <n>.html pageshead no-cache, full pages immutable
commits/index.html, commits/<n>.htmlthe default-branch commit listno-cache
f/<path>.html, f/index.htmlfile pages and their listno-cache
sitemap.xml, sitemap-head.xml, sitemap-<n>.xmlthe sitemap, an index over parts when it is largehead no-cache, parts immutable
robots.txtAllow: / and the sitemap locationno-cache
feed.xml, <dir>/feed.xmlAtom feedsno-cache
.gitsocial/forks/manifest.jsonthe open fork pull requests: the entries of each one, the pack of its head and the bytes of the area; written last, version 1no-cache
.gitsocial/forks/pack/pack-<hash>.{pack,idx}the objects reachable from one fork head and from no bucket ref, plus the review commits of its pull request; non-thin, offset deltas, 32 MB at mostimmutable
.gitsocial/forks/lockthe owner's marker: while it exists the push writes and deletes nothing under .gitsocial/forks/no-cache

Item pages and full list pages are rewritten only when sitePagesVersion in site_pages.go changes; the commit that bumps it says why. Everything else is rewritten on every push.

Artifacts

The app reads the artifacts under .gitsocial/site/, and the bucket's ref list at .gitsocial/refs.json (S3.md), in place of object walks.

KeyContent
versionshell version marker, a hash of the raw assets
items/<ext>/per-extension metadata index: full shards, a mutable head, a manifest; an adopted copy's entry also names its original author and time, the entry of a comment, feedback, repost or quote carries the first line of its content as text, and every other entry the first paragraph after its subject, cut at 280 characters on a word boundary, as excerpt
bodies/<ext>/message bodies, loaded on demand
items/code/one index of plain commits across code branches, with parent shas
bodies/code/the message of each commit in items/code/, which the commit lists of the app read for their excerpts
pages.jsonpage-layer manifest: schema version, consumed tips, bootstrap cursor, list and commits partitions, the sidebar's item counts, the file pages with their keys
site-config.jsonthe customization values, and avatarManifest, the digest of avatars.json, which only the push sets
avatars/<key>the picture of one author, as the forge served it, under the avatar key of the email; written by gitsocial import avatars and by the push from the avatar store; public, max-age=86400
avatars.json{"v":1,"keys":[...]}, the sorted avatar keys that avatars/ holds; written after the pictures by the import and the push; no-cache
pm-config.jsonthe resolved PM board, and whether the framework has milestones and sprints; the sidebar hides the links of a feature the framework lacks
stats.jsona stats blob written by the CLI from the workdir
tags.jsoneach tag's commit, date, author, previous tag and its commit, the commit count since it, and whether its range document is written, in display order, from the local object database
ranges/v1/<prev>..<commit>.jsonone range document for each pair of adjacent tag commits: the merge base, the commits since the previous tag (up to 2,000) and the files changed (up to 1,000); immutable
push-stateskip digest for push-time maintenance
.gitsocial/forks/the fork area: manifest.json lists the open pull requests of registered forks, each entry with the fields of a shard entry, the fork URL, the head and its pack; pack/pack-<hash>.{pack,idx} holds the objects of one head that no bucket ref reaches; lock freezes the area for the push

The app keeps two keys for browser notifications in the localStorage of the browser, and works without them.

KeyContent
gs-notify-emailthe email of the reader, one per origin
gs-notify-seen:<base>["<hash12>",...]: the items of the newest window of each lane, then the older seen items, 500 at most, one per site base

Invariants

The shell and the pages:

Commits pages:

Page entry:

Browser notifications:

Index maintenance:

Push-time maintenance

Every ref-moving push to an s3 remote runs the site rebuild as its part of push maintenance (S3.md), through the site.PostPushMaintenance hook that the CLI gives the remote helper.