Skip to content

Commit 6a23516

Browse files
Add the silvercode.studio home page, with a Pages workflow and lint
The site lists the studio's apps: Silverside, and Silverbox and Silverplay as coming soon. It shares Silverside's look through copies of its tokens.css and site.css, without the HDCD and DTS rules. The studio uses Silverbox's floppy disk as its own icon. A theme button and a phone menu come from Silverside's js/site.js, so the page can go light or dark apart from the system setting, and phones still reach GitHub. Pages now deploys from a workflow, not from the branch, so only the site files go live, and Jekyll does not run. make build copies the files in SITE_FILES to _site for the workflow. make lint finds broken local links and spaces at line ends, and a failure stops the deploy. make site serves the page locally. .editorconfig and .gitattributes set the text style.
1 parent 095287c commit 6a23516

16 files changed

Lines changed: 777 additions & 7 deletions

File tree

‎.editorconfig‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Unix-style newlines with a newline ending every file, and no spaces or tabs at the ends of
7+
# lines (make lint checks that).
8+
[*]
9+
end_of_line = lf
10+
insert_final_newline = true
11+
trim_trailing_whitespace = true
12+
charset = utf-8
13+
14+
[*.{html,css,js,json,yml,yaml}]
15+
indent_style = space
16+
indent_size = 2
17+
18+
[*.pl]
19+
indent_style = space
20+
indent_size = 4
21+
22+
[Makefile]
23+
indent_style = tab
24+
25+
# Kept as their authors or tools wrote them.
26+
[*.svg]
27+
trim_trailing_whitespace = false

‎.gitattributes‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

‎.github/workflows/pages.yml‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Publishes the site to GitHub Pages as https://silvercode.studio.
2+
# In the repository's Settings › Pages, set "Build and deployment" to "GitHub Actions", and set
3+
# the custom domain there: a Pages workflow does not read the CNAME file.
4+
name: Deploy silvercode.studio site
5+
6+
on:
7+
push:
8+
branches: [main]
9+
paths-ignore:
10+
- "**.md"
11+
workflow_dispatch:
12+
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
concurrency:
19+
group: pages
20+
cancel-in-progress: false
21+
22+
jobs:
23+
deploy:
24+
runs-on: ubuntu-latest
25+
environment:
26+
name: github-pages
27+
url: ${{ steps.deployment.outputs.page_url }}
28+
steps:
29+
- uses: actions/checkout@v7
30+
# A broken link stops the deploy.
31+
- run: make lint
32+
- run: make build
33+
- uses: actions/configure-pages@v6
34+
- uses: actions/upload-pages-artifact@v5
35+
with:
36+
path: _site
37+
- id: deployment
38+
uses: actions/deploy-pages@v5

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
tmp
2+
_site/

‎AGENTS.md‎

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,24 @@ This file provides guidance to coding agents when working with code in this repo
66

77
This repo is the GitHub Pages site for `https://silvercode.studio`. Silvercode Studio is the umbrella organization for Preston's open-source apps. The site presents those projects.
88

9-
## Current state
9+
## Structure
1010

11-
The repo is new. It has only `README.md` and no commits. There is no site generator, build step, linter, or test suite yet. When content or tooling is added, update this file with the real commands and structure. Do not assume a framework (for example, Jekyll) until one is present in the repo.
11+
The site is plain static HTML and CSS at the repo root, with no generator or framework. Do not add one (for example, Jekyll) unless asked.
1212

13-
## GitHub Pages notes
13+
- `index.html` is the home page. It lists the apps as cards. Styles that only this page uses are in its `<style>` block.
14+
- `css/tokens.css` and `css/site.css` started as copies of Silverside's (`../Silverside/docs/site/css`), so the studio and the apps share one look. `site.css` no longer has Silverside's HDCD and DTS rules. When you change a shared rule, consider the same change in Silverside's copy.
15+
- `js/site.js` is the theme part and the phone-menu part of Silverside's `js/site.js`. It shows the theme buttons, sets `data-theme` on `<html>`, and keeps a choice in `localStorage` only while it differs from the system appearance. A short script in `<head>` applies the stored choice before the page draws. Without JavaScript, the page follows the system appearance.
16+
- Images: `images/icon.png` is the studio icon, and `images/apple-touch-icon.png` is the same picture. `images/silverbox.png` is the full-size Silverbox icon; the studio uses the Silverbox floppy disk as its own icon.
17+
- `.editorconfig` sets the style: LF line ends, a final newline, no spaces at line ends, and 2-space indents in HTML, CSS, and YAML.
1418

15-
- The repo name `SilvercodeStudio.github.io` makes this an organization Pages site. GitHub publishes it from the default branch (`main`) unless the Pages settings say otherwise.
16-
- When Pages publishes from a branch, the custom domain `silvercode.studio` needs a `CNAME` file at the publish root that contains only `silvercode.studio`. Do not remove or rename it after it is added.
17-
- If the site is plain static HTML with no Jekyll, add an empty `.nojekyll` file at the publish root. Without it, GitHub runs Jekyll and skips files and folders that start with `_`.
19+
## Commands
20+
21+
- `make site` serves the repo root at `http://localhost:8000`. Silverside's `make site` also uses port 8000; set `PORT=8001` to run both.
22+
- `make lint` reports broken local links in `*.html` (`scripts/check-links.pl`) and spaces or tabs at line ends.
23+
- `make build` copies the published files (`SITE_FILES` in the `Makefile`) to `_site/`.
24+
25+
## Publishing
26+
27+
`.github/workflows/pages.yml` runs `make lint` and `make build` on each push to `main`, then deploys `_site/` to GitHub Pages. A broken link stops the deploy. Only the files in `SITE_FILES` are published, so `README.md`, `AGENTS.md`, `Makefile`, and `scripts/` stay off the site. When you add a new top-level page or folder, `*.html` already covers pages; add a new folder to `SITE_FILES`.
28+
29+
Because the workflow publishes the site, GitHub does not run Jekyll, and no `.nojekyll` file is needed. The custom domain is set in the repo's Settings › Pages; the workflow ignores `CNAME`, but it stays as a record of the domain.

‎CNAME‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
silvercode.studio
1+
silvercode.studio

‎Makefile‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Shortcuts for working on the Silvercode Studio website.
2+
#
3+
# make site
4+
# make lint
5+
#
6+
# The site is plain static HTML and CSS at the repo root. GitHub Pages publishes only the
7+
# files in SITE_FILES: make build copies them to _site, and .github/workflows/pages.yml
8+
# uploads that folder.
9+
10+
# What the site is made of. Add new top-level pages and folders here.
11+
SITE_FILES = *.html css js images CNAME
12+
BUILD_DIR = _site
13+
14+
# Silverside's make site also uses 8000; set PORT=8001 to run both at once.
15+
PORT ?= 8000
16+
17+
# Text files with spaces or tabs at the ends of lines; .editorconfig has editors trim them.
18+
WHITESPACE_EXCEPTIONS = ':!*.svg'
19+
20+
.PHONY: help site build lint
21+
22+
help:
23+
@echo "make site serve the website (the repo root) at http://localhost:$(PORT)"
24+
@echo "make build copy the published files to $(BUILD_DIR), as the Pages workflow does"
25+
@echo "make lint report broken local links and spaces at the ends of lines"
26+
@echo "Set PORT=n to use a different port."
27+
28+
# The website, as GitHub Pages serves it.
29+
site:
30+
python3 -m http.server $(PORT) --bind 127.0.0.1
31+
32+
build:
33+
rm -rf $(BUILD_DIR)
34+
mkdir -p $(BUILD_DIR)
35+
cp -R $(SITE_FILES) $(BUILD_DIR)/
36+
37+
lint:
38+
@scripts/check-links.pl *.html
39+
@if git grep -nI --untracked -E '[[:blank:]]+$$' -- . $(WHITESPACE_EXCEPTIONS); then \
40+
echo "Spaces or tabs at the end of the lines above: remove them."; exit 1; fi

0 commit comments

Comments
 (0)