Skip to content
daybritePublic

About

Template for Day app landing pages and screenshot galleries

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

daysite

Astro template that turns a conventional Day project into a published website: a localized landing page, a per-platform screenshot gallery, download links for every packaged target, and the hosted web build — generated from data the repository already maintains, so the site needs almost no metadata of its own. It publishes two versions of the app side by side, the newest release and the newest build of the default branch; see Build channels.

How an app uses it

An app repository adds a website/ directory holding only its site-specific choices:

your-app/
├── Day.toml               # already there — id, title, targets
├── store/                 # already there — the store listing, text per locale included
│   └── storefront.toml
└── website/
    ├── site.toml          # host + styling knobs (see below)
    └── theme.css          # optional CSS overrides

The template is fetched, not vendored: the shared daybrite/actions dayapp.yml workflow checks out this repository at build time, synthesizes the site data, builds, and deploys to the repository's GitHub Pages. Nothing but the two files above lives in the app repo. Template fixes reach every site on its next build (the workflow's daysite-version input, default main, selects the revision; the Day apps build against main on purpose). The two-file arrangement remains the default. Projects that need their own branding, components, or Astro pages can opt into customization, without copying or forking the template.

The published site is self-contained: every script, stylesheet, image, and font it loads is served from the site itself (system fonts; the store badges, platform icons, and permission icons are vendored under public/ with their provenance beside them). The build enforces this: an astro:build:done hook scans the output for a resource loaded from another origin and fails the build on the first one. Plain links out, such as the store listings and the privacy page, are fine, and so are images an app index keeps on the app's own repository (source.assets, which an appindex-driven site may declare): that is the data's choice, named in the build log, not something the template loads. Build time still needs the npm registry for the packages in package-lock.json, and the workflow reads GitHub for what the newest release carries — its asset list, its screenshots, its web build — and hands each to the generator as a file or a directory, so the generator itself never touches the network.

Moving a built site

The generated site uses document-relative URLs. The same dist/ directory can be served at https://example.org/, https://example.github.io/Project/, or a nested preview path without rebuilding. Copy the entire directory, including _astro/, app/, gallery/, and any staged web builds and downloads. The server must serve directory indexes and redirect directory URLs without a trailing slash to their slash form; GitHub Pages does this.

Navigation, styles, scripts, screenshots, favicons, channel aliases, and install-manifest resources follow the directory where the site is served. Search, QR codes, and copyable web-app addresses resolve the current deployment at runtime. Basic navigation and presentation also work with JavaScript disabled. No <base> element or client-side link repair is required.

host still declares the canonical public URL for search engines, social metadata, sitemaps, robots.txt, the feed, and the generated GitHub Pages CNAME. Change it when adopting a new domain and rebuild to update those declarations. Relative links do not configure DNS or GitHub Pages settings. For Actions deployments, configure the custom domain in the repository's Settings → Pages; GitHub ignores the artifact's CNAME file. See Day's app website guide for Pages and DNS setup. Explicit external links and externally hosted assets keep their supplied URLs. The template does not rewrite the internals of a separately built web app; that app must use portable resource paths itself. Browser storage, installed PWAs, and service workers remain bound to their original origin/scope and are not migrated by moving the website.

The build converts HTML and CSS URLs after Astro emits its assets, before Pagefind indexes the pages. Vite emits relative URLs inside JavaScript chunks. A page's relative daysite-root meta value supplies the root for runtime features. Tests exercise the same build at three mounts, with requests outside each mount returning 404:

npm test
npm run build
npx playwright install chromium
node scripts/check-portability.mjs dist

The browser check expects the sample's English and French pages. CI also enables search and multiple channels so deep gallery pages and channel redirects are covered.

Build channels

The site publishes the app up to three times, and a version picker above the platform picker switches between them. They are assembled from deliberately different sources.

/<locale>/ — the release /<locale>/prerelease/ — a pending pre-release /<locale>/main/ — the branch
picker label the release's version, 1.2.3 the pre-release's version, 1.3.0-beta.1 the default branch, main
downloads the release's own packages, at their releases/download/<tag>/ URLs the pre-release's own packages, the same way this run's packages, served from the site under main/downloads/
version the released tag, so a checkout that has moved on does not change what the release pages report the pre-release's tag the version in Cargo.toml, with the build number beside it
screenshots the release's screenshots.tar.xz, unpacked by the day CLI the pre-release's, the same way the captures this run's dayscripts took
web app the release's own web-dom dist, at /webapp/ the pre-release's, at /prerelease/webapp/ this run's, at /main/webapp/
page as published carries a pre-release notice and a link to the release carries a development-build notice and a link to the release

A pre-release is pending when it was published after the latest release: a beta of the next version, waiting to be marked Latest. The workflow's tab-release, tab-pre-release and tab-main inputs turn each tab off; all three are on by default, and the pre-release tab appears only while a pre-release is pending.

The point of the split is that the release channel is built from assets the release already carries and nothing else, so what a visitor downloads is the version the page names. The development channel is built from the artifacts of the CI run that published the site, and says so on every page. Its packages are copied onto the site because a GitHub Actions artifact needs a signed-in account and expires with the run's retention window; that adds the size of one full package set (Day Rise's is 117 MB) to each Pages deploy.

A repository with no release publishes main at the locale root instead, the picker has one entry and is not drawn, and /<locale>/main/ redirects there — so a link made before the first release still resolves after it.

The development and pre-release notice is one line rather than a banner, and it is placed in layout the page already has: inside the hero's text block, which from sm up is shorter than the app mark beside it, and under the gallery's version picker. Every channel's pages are then the same height, so the picker a visitor just clicked, and everything below it, stays exactly where it was. Give the notice a block of its own and the release and development pages differ by its height, which is a jump on every switch.

scripts/generate-site.mjs assembles all of this and writes channels.json beside site.toml; src/lib/channels.ts is what the pages read. Without a channels.json the site has exactly one channel, which is the layout every daysite had before channels existed.

site.toml

# Required — the canonical URL. A path component sets the preferred public location,
# so a GitHub project page just works:
host = "https://daybrite.github.io/Day-Skies"

# Everything below is optional.
title = "Day Skies"            # default: the localized store name
tagline = "Weather, beautifully native"
about = "README.md"            # a Markdown file for the About section, relative to the project root (see below)
accent-color = "#4A90D9"
default-theme = "system"       # light | dark | system
default-platform = "web"       # platforms key preselected in the picker
icon-effect = "raise"          # what the app mark does on hover (see below); "none" turns it off
webapp = "webapp"              # subdirectory hosting the web-dom build (default "webapp")
screenshot-placement = "below-about"  # below-about (default) | above-about: the carousel under the description, or first after the hero
show-gallery = true
show-permissions = true
show-store-badges = true
show-qr-code = true            # the toolbar QR code of the landing page, full screen when tapped
show-source-link = true
footer = "© {year} Daybrite" # optional, prints under the Day attribution; {year} interpolates
pagefind = false               # site search index
optimize-png = false           # recompress the built PNG files with oxipng (true, or a level 0-6)

about

The landing page's About section shows the store listing's description. about names a Markdown file to show there instead, relative to the Day project root (the directory holding Day.toml; about = "README.md", about = "docs/about.md"). The path may climb above the project (about = "../../.github/README.md" for a Day project inside a larger repository), because CI checks out the whole repository. Naming a file that does not exist fails the build.

Without the key, a project whose listing has no description text in any locale gets its README.md when it has one, so the page shows real text rather than an empty section; the generator's log names the file it used. A listing with a description keeps it.

The generator renders the file with Astro's own Markdown pipeline (@astrojs/markdown-remark, GitHub-flavored) into the appindex, under the storefront's default locale; every other locale shows the same text, through the ladder the description already uses. Three edits are made on the way:

  • The leading H1 is dropped, since the hero already shows the app's title. Headings, lists, code blocks, and tables stay.
  • Relative links are resolved against the file's place in its git repository and pointed at GitHub (https://github.com/<owner>/<repo>/blob/<branch>/<path>, the checked-out branch, or main when the checkout is detached). Anchors and absolute URLs stay. Without a repository (--repo, GITHUB_REPOSITORY, or the origin remote) relative links stay as written.
  • Images become links. The site loads nothing from another origin (the build hook above), and a README's images live elsewhere, on GitHub or on the app's published gallery. Each <img> is replaced by a link to the image whose text is the alt text; a relative source is first rewritten to its raw.githubusercontent.com URL.

The text is rendered as written (it is a file in the project's own repository), not passed through the sanitizer the store description goes through.

Screenshots as WebP

Every capture the carousel and the gallery show is a <picture>: a WebP for the browsers that take one (all current ones), the published PNG for the rest. When the gallery is assembled, scripts/webp.mjs encodes each capture with sharp at quality 80 as <shot>.webp beside <shot>.png (gallery/<target>/<variant>/home.webp next to home.png); a capture that already has one is left alone. On the Showcase's 8,496 shown captures the WebP files are 34% of the PNG files' size (396 MB against 1,164 MB). The PNG keeps its URL, which is what the published gallery.json names and what other sites and the stores read. The gallery's theme and locale switcher swaps the WebP source and the PNG together, and the full-size viewer shows whichever the browser chose. The WebP files live under public/ with the PNG files, so astro dev serves them too.

node scripts/image-report.mjs [dist] lists, after a build, how much PNG the pages offer as WebP, the largest captures, and any gallery PNG no page offers as WebP. CI prints it after the sample build. The icons and badges stay PNG and SVG.

optimize-png

With optimize-png = true, the build recompresses every PNG file in the output with oxipng after Astro finishes: the screenshots, the icons and the badges. The hosted web app's files are left as the app built them. The pixels stay the same. On a Day app's captures, level 1 saves 15% and takes 0.6 CPU-seconds per 2752×2064 image; level 0 saves 7% in a fifth of the time, and level 2 saves 17% in twice the time. optimize-png = 2 names a level.

The published gallery.json records each capture's bytes and sha256, so the build refreshes the entries of the files it rewrote.

The build runs the oxipng on PATH, or the one DAYSITE_OXIPNG names. Without one it warns and publishes the files as built. The dayapp.yml website job installs a pinned oxipng when the site sets the option.

icon-effect

The landing page's app mark answers to hover and to tap, by moving the layers a Day SVG master marks by id — day:background, one or more day:foreground…, and the day:monochrome silhouette that otherwise ships hidden for the platforms' tinted-icon modes (the day repository's docs/icons.md). raise is the default; none turns it off.

value what moves suits
raise the motif lifts off the backdrop and casts a shadow onto it, and the backdrop dims any master
tilt the mark turns toward the pointer and the motif leads the backdrop into the turn art with layers worth separating
bloom each shape in the motif steps outward from the centre in turn; a shape at the centre stays motifs arranged around a centre
emboss day:monochrome moves under the motif and shows as a shadow matching it shape for shape any master that ships the layer
iris the backdrop opens and brightens behind a motif that barely moves backdrops with a gradient or a glow
spin the motif turns once, all the way round, and lands where it started any master

Three details decide whether an effect is worth setting on a given app:

  • The master has to mark layers. CSS cannot reach inside an <img>, so a live effect inlines the SVG master into the page. A project with a raster-only icon, or an SVG that marks no day: layers, renders the plain mark and no effect — whatever this key says.
  • bloom and iris read the artwork. Bloom moves each shape along the radius it already sits on, so a motif whose shapes all sit at the centre barely moves; iris opens the backdrop, so a flat-color backdrop only brightens.
  • Every effect rests where the page already was. prefers-reduced-motion keeps the change of state and drops the travel, and nothing in the hero reflows when the mark moves.

Gallery curation lives in the app's dayscripts, not here: a screenshot: step with a localized title: (and optionally caption: and source:) becomes a curated gallery row, in the script's own order — day screenshot index carries the metadata into the gallery.json this template consumes. See the day repository's DESIGN.md §14.7.

Where the content comes from

CI generates these files next to site.toml; none is committed. scripts/generate-site.mjs runs the two generators once per build channel and writes channels.json last, so a second channel's copies land under its own segment (main/appindex.json, main/gallery-manifest.json, public/main/gallery/).

File Written by From
channels.json scripts/generate-site.mjs the channel list the workflow hands it: which build each channel describes, its label, its URL segment, and where its data and web build live
appindex.json scripts/generate-appindex.mjs day store export (--storefront FILE, or run through DAY_BIN): the app's id, title, version, build and targets, the live App Store / Google Play listings, the listing text resolved per locale, each store record's bundle id, and the declared permissions with their native keys per platform and reasons per locale; the latest release's asset list (--release-assets FILE, written by the workflow with gh api) or a directory of packed artifacts to serve from the site (--downloads DIR); the icon family under build/day/host/png/ or resource/icons/; the About text rendered from site.toml's about file (--about FILE), or from README.md when the listing has no description
gallery-manifest.json scripts/assemble-gallery.mjs day screenshot index's gallery.json in the capture tree (falling back to scanning the <target>/<variant>/<shot>.png trees directly)
public/gallery/gallery.json rebuilt by scripts/assemble-gallery.mjs day screenshot index, filtered to the captures this run actually published (see "What renders")

The app icon

The site's identity is the project's own icon, copied rather than rendered. The generator looks first for the size-exact day-icon-<N>.png family that day icon build writes under build/day/host/png/ (the workflow runs day icon build -p web-dom for exactly this; a day new scaffold also ships a copy under resource/icons/png/), copies its largest size to public/app/icon.png for the landing page's app mark and the Open Graph image, and its 64, 256, and 512 px sizes to public/app/ as the favicon, apple-touch-icon, and PWA tile. The build then links them from every page's <head>; no image library is involved, and the SVG master, when the project ships one, is served raw beside them and is what browsers prefer.

Without the family, the largest PNG under resource/icons/ (directory preference png/, then ios/, linux/, windows/, android/, the icons/ root, and macos/ last, whose art is pre-rounded) is the app mark and fills every favicon slot at its own size. A project with no PNG at all gets the SVG master alone, or no app mark; the generator says so.

Home screen

A site that hosts the web build (public/<webapp>/, staged by the workflow) is installable from its landing page: src/pages/site.webmanifest.ts emits a web app manifest whose start_url is the hosted app, whose identity defaults to that URL, whose scope is the whole site, whose icons are the favicon set above, and whose screenshots are the gallery's phone captures (narrow) and desktop captures (wide), and Layout.astro links it from every page. "Add to Home Screen" from the site then installs the app itself, with the same name and icon the app's own manifest declares (day build -t web-dom writes that one, plus the offline service worker; see the day repository's docs/web.md, "Home screen and offline"). Without a staged web build the manifest is still emitted but not linked, so the site never installs as an app of its own.

appindex.json conforms to the appindex schema — platforms.ios / platforms.android mean what they mean there — plus Day's additive extension: entries under macos, windows (the WinUI 3 build), linux-gtk, linux-qt, harmony, and web keys, and a per-platform artifacts array carrying the releases/download/<tag>/ URLs of the release the channel describes (src/lib/day-targets.ts is the vocabulary). An appindex consumer reads the subset it understands; the document doubles as the app's machine-readable publication record.

What renders

  • /<locale>/ — the landing page: version picker and platform picker (first, since between them they select what everything below shows), hero, screenshot carousel, localized store description, per-platform download card (on macOS, Windows and Linux, ending with the release's one-line install command in a field with a copy button; on the web, headed Open and holding the web app's address the same way), and an About card carrying that platform's way to get the app — the Open the web app button when a web build is hosted, the App Store or Google Play badge for a listed app (badges vendored under public/badges/<locale>/, see the README there), otherwise the lead package from the latest GitHub release — then permissions and release notes. One page per store locale, with the same locale-fallback ladder as appland.

    The chosen platform is bookmarkable as a fragment — /<locale>/#macos-appkit, spelled with the Day target id (the shorter appindex key, #macos, resolves too and rewrites itself to the canonical form). It outranks both automatic choices, the visitor's own OS and their last pick, and the version picker's links carry it, so switching 1.2.3 ↔ main stays on the platform being read about. A fragment rather than a per-platform page because the page already holds every platform's content — the picker only hides sections — so splitting it would turn one indexable page into eight near-duplicates without revealing anything new. A visitor who was auto-selected keeps the clean URL; only an explicit choice writes one, with replaceState, so clicking through platforms leaves no history to back out of.

  • /<locale>/gallery/ — one row per captured screen, every platform side by side, phones and tablets in hardware bezels and desktops in their native window chrome (Adwaita, Breeze, traffic lights, caption buttons — src/styles/shells.css, shared with daybrite.dev), with theme and locale switchers when the capture matrix has them. Row headings and captions come from the dayscript metadata, in the page's own locale (missing locales fall back to English). Clicking a screenshot opens a full-size viewer with two-axis navigation: ←/→ walk platforms across one screen, ↑/↓ walk screens on one platform. Generated only when captures exist.

  • /gallery/gallery.json — the machine-readable index of every published screenshot, written by day screenshot index: file name, absolute URL, shot id, localized title and caption, platform-toolkit, theme, locale, pixel dimensions, byte size, and sha-256. Other sites reference the gallery through it — daybrite.dev builds its app galleries from these indexes — and any tool can enumerate the screenshots without scraping pages. Each build channel serves its own: this one describes the channel at the locale root, and /main/gallery/gallery.json the development build. The CLI spells every entry gallery/…, so the assembler rewrites a second channel's path and url to point at that channel's own copies; before it did, main/gallery/'s index linked the release channel's images, and daybrite.dev dropped every app whose release channel had none.

    Two rules keep it honest, and they are deliberately different from the page's:

    1. Every capture is published, curated or not. Curation (a title:) decides which shots get a row on the gallery PAGE; it does not decide which bytes go on the site. An index entry naming an image nobody uploaded is worse than no entry.
    2. The index is rebuilt from what was published, not copied through. An entry whose file is missing from the capture tree — an artifact that failed to upload, a trimmed download — is dropped from the index (and named in the build log) rather than shipped as a dead URL. The invariant is covered by scripts/assemble-gallery.test.mjs (npm test).
  • /<locale>/main/ and /<locale>/main/gallery/ — the same two pages for the development channel, from that channel's own data (see Build channels).

  • /<webapp>/ and /main/<webapp>/ — each channel's web-dom build, staged by the deploy workflow next to the site.

  • /main/downloads/ — the development channel's packages, as the CI run packed them.

A repo with a web-dom target and no website/ directory keeps the old behavior: the workflow deploys the bare web app at the Pages root.

Local preview

cd your-app/website
git clone https://github.com/daybrite/daysite .daysite   # add .daysite/ to your .gitignore
npm --prefix .daysite install
node .daysite/scripts/preview.mjs

The plain run needs no network: one channel, from this checkout, with build/day/screenshots/ from your last local day launch --script run as the gallery and no download cards, since only the workflow looks a release up.

--ci assembles what the workflow publishes — both channels, the release one from the newest GitHub release's assets and the development one from the newest successful run of the default branch. It shells out to gh for both and caches the downloads under build/day/daysite/, so a second run is fast. --run <id> picks a specific workflow run and --no-serve generates the data and stops.

node .daysite/scripts/preview.mjs --ci

Point DAYSITE_CONFIG at any site.toml to drive a bare template checkout against another app's data; both the generator and the Astro build read it.

Continuous integration

.github/workflows/ci.yml builds the bundled sample on every push and PR, and — on pushes to main and version tags — scaffolds a fresh Day project with the day CLI (day new app, whose default scaffold includes website/), builds its web-dom target, runs this checkout of the template over the scaffold's own data, and deploys the result to this repository's GitHub Pages with the web app under /webapp/. Template changes are thereby exercised against exactly what the CLI generates, and the deployed artifact is browsable at https://daybrite.github.io/daysite/.

Template development

npm install && npm run sample && npm run dev in a bare checkout serves the sample: Day Showcase as it is on its main branch, which npm run sample clones, exports with the day CLI (DAY_BIN, else day) and generates the site's data from the way CI does for a real repository, with a few of the screenshots the Showcase's own site publishes (samples/README.md). Point DAYSITE_CONFIG at any site.toml to build against real app data.

About

Template for Day app landing pages and screenshot galleries

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages