Skip to content

feat(home): deep-link and persist the A–Z article index letter in the URL - #1973

Closed
dhgoal wants to merge 1 commit into
e35ventura:testfrom
dhgoal:ui-ux/home-index-deeplink
Closed

feat(home): deep-link and persist the A–Z article index letter in the URL#1973
dhgoal wants to merge 1 commit into
e35ventura:testfrom
dhgoal:ui-ux/home-index-deeplink

Conversation

@dhgoal

@dhgoal dhgoal commented Jul 3, 2026

Copy link
Copy Markdown

Summary

The home page's A–Z article index is a client-side letter filter, but the selected letter lives only in client state. This adds URL-hash deep-linking so the index behaves like the rest of the site's shareable surfaces — the same URL-state treatment the search facets got in #1955.

  • Clicking a letter writes #<letter> to the URL via history.replaceState (no scroll jump, kept out of back-button history).
  • An incoming #<letter> is honoured on first load and on hashchange (back/forward).
  • The hash is validated to a single A–Z that actually has an article group, so a stray hash (e.g. the #content skip-link target) or a letter with no articles is ignored and the current selection is left untouched.

Scope is the home page's existing inline script only — no markup, styling, or layout changes.

Why This Should Ship

Issue #521 asks for stronger article discovery on the landing page. Today taopedia.org/#M just shows the default first letter — a shared or reloaded index link silently loses its place. After this, a reader (or a link) can jump straight to a letter and the choice survives reload and sharing. It reuses the exact URL-state pattern the maintainer already accepted for search facets (#1955). Refs #521.

Review Notes

  • One file of behaviour (src/pages/index.astro inline script) + a test; package.json wires the test script.
  • Test: npm run test:home-index-deeplinkscripts/check-home-index-deeplink.js pins the URL-state contract in source and executes the shipped inline script against a DOM stub, verifying deep-link on load, click→#letter persistence, hashchange resync, and that stray/foreign hashes are ignored.
  • Progressive enhancement unchanged: with no hash (or JS off) the server-rendered default letter is shown exactly as before.

Before — visiting /#M ignores the hash (index stuck on the default letter)

before

After — visiting /#M deep-links straight to the M articles

after

Evidence is a faithful local render of the article-index section — the component's own CSS and the actual shipped inline script, loaded headless at …#M. The live change is also visible on the Netlify deploy preview.

Target Branch

  • This PR targets test
  • This PR targets main only because it promotes test to production

Security Checklist

  • No secrets, tokens, build hooks, wallet seeds, or private endpoints are included
  • No unnecessary workflow, dependency, or deployment changes

Requested label: ui-ux

… URL

The home page article index is a client-side A–Z letter filter, but the
selected letter lives only in client state: reloading resets it to the
first letter, the choice can't be shared, and an incoming #<letter> is
ignored. This mirrors the gap the search facets closed in e35ventura#1955.

Persist the active letter in the URL hash (history.replaceState — no
scroll, kept out of back-button history) and honour an incoming #<letter>
on load and on hashchange (back/forward). A hash is validated to a single
A–Z that has an article group, so a stray hash (e.g. the #content skip
link) or a letter with no articles is ignored and the current selection is
untouched.

scripts/check-home-index-deeplink.js pins the contract and executes the
shipped inline script against a DOM stub to verify the behaviour end to
end (deep-link, persistence, hashchange resync, stray-hash guard).

Refs e35ventura#521
@dhgoal
dhgoal requested a review from e35ventura as a code owner July 3, 2026 05:24
@taopedia-site-maintainer taopedia-site-maintainer Bot added the feature Website feature or behavior request label Jul 3, 2026
@taopedia-site-maintainer

Copy link
Copy Markdown

Verdict: Close

PR #1973: feat(home): deep-link and persist the A–Z article index letter in the URL

This PR changes toggle-driven on-screen behavior. Code analysis confirms the visible effect only appears during the interaction, so static before/after screenshots cannot demonstrate it (an identical-looking pair is not valid evidence). A short screen recording or GIF is required.

Visual PRs need evidence in the PR description so the maintainer can review the change quickly and reliably. A deploy preview link alone is not enough.

Required evidence for resubmission:

  • Page URL.
  • Viewport width, especially for responsive changes.
  • Action taken (the toggle that reveals the change).
  • Expected before behavior.
  • Expected after behavior.
  • A short video/GIF that shows the change happening during the interaction. Static screenshots alone are not accepted for this PR.

Changed files:

  • package.json
  • scripts/check-home-index-deeplink.js
  • src/pages/index.astro

CI: Checks still pending: build

Please open a new focused PR with the required evidence attached.


Automated review by Taopedia Site Maintainer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Website feature or behavior request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant