My personal homepage. It's plain HTML, CSS, and JavaScript, with no frameworks, no build step, and no dependencies.
index.html page structure
404.html shown for any URL that doesn't exist; sends the visitor to the homepage
sw.js service worker: keeps a copy of the site so the homepage works offline
styles.css all styling; theme colors/spacing/glows are CSS variables at the top
script.js title animations, card tilt, particle background, card rendering, 404 banner, offline setup
projects.js the list of project cards ← edit this to add projects
images/ card images (PNG, 1200×900) and social-preview.png (the link-preview picture)
fonts/ JetBrains Mono, served from this site (OFL.txt is its licence)
card-image-prompt.txt the brief for making a new card image (paste it into an image or design tool)
favicon.ico, apple-touch-icon.png site icons for older browsers and phone home screens
robots.txt, sitemap.xml tell search engines what to index
CNAME the custom domain for GitHub Pages (don't delete)
LICENSE MIT for the code; see the note at the bottom for what it doesn't cover
Open projects.js and add one object to the PROJECTS array:
{
title: "My Cool Game",
image: "images/my-cool-game.png",
url: "https://my-cool-game.carterscoding.com/",
alt: "Screenshot of the game's title screen", // optional
},Cards show up in the same order as the list. To remove a card, delete its object. To reorder, move the objects.
urlopens in the same tab. It can be a full link (https://…) or a path on this site (/my-cool-game/). Anything else (likejavascript:) is ignored and the card links nowhere.- If
altis left out, the image alt text defaults toPreview of <title>. - Add
featured: trueto pin a card to the top with a glowing "Featured" label above its title. Featured cards stay first (in list order among themselves) whichever sort is picked.
Above the cards, a search box filters them by title as you type (ignoring case and accents), and the sort button switches between date added (the order in projects.js, so add new projects at the bottom) and A–Z. Both are in section 1 of script.js; the controls are in index.html next to the "Projects" heading.
To make a new card image, give an image or design tool the brief in card-image-prompt.txt. Then:
- Put the image in the
images/folder, e.g.images/my-cool-game.png. - Set that path as the project's
imageinprojects.js. Paths are case-sensitive on the live site, soMy-Game.pngandmy-game.pngare different files. - Delete any old image in
images/that no project uses anymore.
Tips:
- Card images are PNG, 1200×900 (4:3, the same shape as the cards). That's sharp on retina screens at every card size.
- File size: the current images are about 135 KB to 335 KB each, except
four-kingdoms.pngat about 1.1 MB. Aim for under ~300 KB; the first card loads first, so a big image there slows the page the most. squoosh.app can shrink a PNG without changing how it looks much. - A dark gradient sits behind the title: the bottom ~30% is heavily darkened, it fades out up to about 60% of the way up, and the top is only lightly tinted. Put the interesting part in the top half.
- The card keeps the 4:3 shape on almost every screen, but on very narrow cards (phones under ~350px wide, and some in-between window widths) the sides get trimmed slightly. The image also zooms in a little (8% on hover), so keep important details away from the edges.
- If an image path is wrong or the file is missing, the card falls back to a green pattern instead of breaking.
Everything themeable in CSS is in the :root { … } block at the top of styles.css: colors, glow strengths, spacing, corner radius, fonts, and animation speeds.
- For a different accent color, change both
--c-accentand--c-accent-rgb(the particles use the RGB version; keep it as three numbers with commas). Then retint--c-bg-glow-2,--c-bg-glow-3,--c-card-fallbackand the--c-flap-*tile colors to match. - For a different background, change both
--c-bgand--c-bg-rgb. - A few colors live outside
styles.cssand need changing by hand: the favicon inindex.html(%2300ff9cand%23050806),favicon.icoandapple-touch-icon.png, thetheme-colormeta tag in both HTML files, the inline styles in404.html, theCOLORSlist in the DVD effect inscript.js, andimages/social-preview.png(a screenshot of the page).
Clicking the title plays one of 15 animations at random, never the same one twice in a row: decode, scatter, glitch, shockwave, typewriter, crt, rain, flap, progress, jello, dvd, capslock, battery, autocorrect, and buffering.
- Try one on its own: add
?effects=plus its name to the URL, e.g.http://localhost:8000/?effects=crt. Separate several with commas:?effects=crt,rain. - Add a new one: write a function inside
initTitle()inscript.jsand add it to theeffectsobject. It joins the random rotation automatically. - Remove one: delete its name from the
effectsobject.
GitHub Pages (and Netlify) serve 404.html for any URL on the site that doesn't exist. That page does one thing: it remembers the bad URL and sends the visitor to the homepage, where a banner at the bottom of the screen says the URL didn't exist and they've been redirected.
- The two files work as a pair.
404.htmlsaves the bad URL in the browser'ssessionStorageundercarterscoding:notfound; section 6 ofscript.jsreads it, shows the banner once, and deletes it. If you rename the key, change it in both places. - The banner stays until it's dismissed with the × or the Escape key. Its look is the
.bannerrules instyles.css. - With JavaScript turned off the redirect still happens, just without the banner.
- It only covers this site. Each project subdomain is its own site with its own 404 page.
- To try it locally, open
http://localhost:8000/nopewith a server that serves404.htmlfor missing pages (npx servedoes;python3 -m http.serverdoesn't). Opening/404.htmldirectly just redirects home without a banner, since that file does exist. Or visit a made-up URL on the live site.
After someone has visited once, the homepage works with no connection: sw.js (a service worker, registered at the bottom of script.js) saves the page, styles.css, script.js, projects.js, the font, the icons and every card image listed in projects.js.
- Online, nothing changes: every file still comes from the site, and the saved copy is refreshed along the way. The saved copy is only used when the network fails, so a deploy shows up just like before.
- Adding or removing a project needs nothing extra.
sw.jsreads the image list fromprojects.js, and browsers notice when either file changes and save the new set (removed images are deleted). - Adding a new file the page needs (another script, stylesheet or font): add it to
CORE_FILESat the top ofsw.js. - Project links open other sites, so those still need a connection. Offline, any URL on this site shows the homepage (without the 404 banner).
- Service workers only run over HTTPS or on
localhost, so double-clickingindex.htmlskips this. To try it: serve the folder, load the page, then in Chrome DevTools → Application → Service workers tick Offline and reload. - To clear a stuck copy in your own browser: DevTools → Application → Storage → Clear site data.
Double-clicking index.html works, except that browsers won't load the font from a local file, so text shows in your system's monospace font. For behavior that matches the live site exactly, serve the folder instead:
cd path/to/Homepage
python3 -m http.server 8000
# then open http://localhost:8000(npx serve also works if you have Node installed.)
-
The code lives at github.com/cksarge/Homepage on the
mainbranch, withindex.htmlat the repo root. Every file you commit is published on the site, so check what's about to go in first. Push changes with:git status # make sure only the files you meant to change are listed git add index.html styles.css # (the files you changed) git commit -m "Describe your change" git push
.gitignorealready keeps out editor folders, logs,.envfiles and the like. -
In the repo on GitHub, go to Settings → Pages. Under Build and deployment, choose Deploy from a branch, then main and / (root), and click Save.
-
Under Custom domain on the same page, enter
carterscoding.comand click Save. This commits aCNAMEfile to the repo on GitHub. Keep it, and rungit pullonce so your local copy has it before you push again. -
At your domain registrar, set these DNS records:
Type Name / Host Value A @185.199.108.153A @185.199.109.153A @185.199.110.153A @185.199.111.153AAAA @2606:50c0:8000::153AAAA @2606:50c0:8001::153AAAA @2606:50c0:8002::153AAAA @2606:50c0:8003::153CNAME wwwcksarge.github.ioRemove any other A/AAAA records on
@(registrars often add a "parked" one). -
DNS can take anywhere from minutes to a day to update. When the Pages settings show the DNS check passing, turn on Enforce HTTPS.
To update the site later, commit and push. Pages redeploys within a minute or two. When you change styles.css, script.js or projects.js, also bump the ?v=… date on those files in index.html, so visitors' browsers fetch the new copies instead of using a cached one for up to 10 minutes.
- Sign in at netlify.com, then Add new site:
- Quickest: choose Deploy manually and drag a folder onto the page. Drag a copy that holds only the site files, not the whole
Homepagefolder: a manual upload sends everything in it, including hidden files like.DS_Storeand.git. - Auto-deploy on push (recommended): choose Import an existing project, connect the GitHub repo, leave Build command empty, and set Publish directory to
.(or leave it blank).
- Quickest: choose Deploy manually and drag a folder onto the page. Drag a copy that holds only the site files, not the whole
- Go to Domain management → Add a domain, enter
carterscoding.com, and follow the prompts. Netlify will also set upwww.carterscoding.com. - Point DNS at Netlify. Pick one:
- Netlify DNS (easiest): at your registrar, replace the nameservers with the four Netlify shows you.
- Keep your registrar's DNS: add an
Arecord for@→75.2.60.5and aCNAMEforwww→<your-site-name>.netlify.app.
- Netlify issues a free HTTPS certificate automatically once DNS resolves.
- Reduced motion: if a visitor's OS has "reduce motion" turned on, the particles, background drift, title animations, background click bursts, card tilt, and zoom are all turned off.
- Performance: the first row of card images loads straight away and the rest lazy-load, the particles pause when the tab is hidden, and fewer particles are drawn on phones.
- No outside requests: everything, including the JetBrains Mono font, is served from this site, so visitors' browsers never contact another server. A Content-Security-Policy in each HTML file enforces that. If you add something from another site (a script, font or image), add its address to that policy or the browser will block it.
- Contact address:
contact@carterscoding.comis in the page as plain text on purpose, so it works without JavaScript; spam filtering is left to the mail routing.