Landing & Transition Pages
Relevant source files
The following files were used as context for generating this wiki page:
The Landing Page serves as the primary entry point for unauthenticated users, providing an overview of the GoGovSG service, statistics, and call-to-action (CTA) elements for signing in. The Transition Page manages the user experience when a visitor accesses a shortened link for the first time, acting as an intermediary safety check before redirecting to the destination URL.
Landing Page Architecture
The Landing Page is implemented in src/client/home/index.tsx and utilizes a modular "sliver" architecture. It serves three distinct environment variants: gov, edu, and health. Each variant displays unique assets, copy, and themes based on the ASSET_VARIANT environment variable.
Component Structure
The page is composed of several horizontal sections (slivers) wrapped in a BaseLayout:
- LandingGraphicSilver: Displays the main catchphrase, sub-description, and a primary "Shorten your links now" CTA button.
- TrustedBySliver: Lists organizations using the service.
- DescriptionSliver: Details core features like anti-phishing and analytics.
- StatisticsSliver: Shows real-time or cached usage data (links created, clicks, user count).
Sources: [src/client/home/index.tsx:44-77], [src/client/home/components/LandingGraphicSilver.tsx:109-170], [README.md:144-152]
Logic and State Management
When the component mounts, it triggers several initializations:
- Checks authentication status via
loginActions.isLoggedIn(). - Fetches link rotation configurations via
homeActions.getLinksToRotate(). - Initializes monitoring and records a Google Analytics page view.
- Redirects authenticated users automatically to the
/userdashboard.
Sources: [src/client/home/index.tsx:24-42]
The diagram above illustrates the decision logic when a user first lands on the home page. Sources: [src/client/home/index.tsx:39-51]
Transition Page Logic
The Transition Page is a security and user-experience feature shown when a user clicks a shortened link. It informs the user they are being redirected to an external site.
Behavior and Timers
The transition process follows a specific lifecycle:
- First-Time Visit: Accessing a short link for the first time displays the transition page.
- Automatic Redirect: A timer (approximately 6 seconds) automatically triggers the browser to navigate to the long URL.
- Manual Skip: A "Skip" button is provided, allowing users to bypass the timer immediately.
- Cookie Suppression: Once a user has successfully transitioned, a cookie is set to suppress the transition page for subsequent visits to the same link.
Sources: [test/end-to-end/TransitionPage.spec.ts:31-53]
The sequence diagram details the interaction between the user and the redirect mechanism. Sources: [test/end-to-end/TransitionPage.spec.ts:35-57]
Asset and Environment Variants
GoGovSG uses Webpack aliasing to inject environment-specific assets (logos, favicons, and metadata) during the build process.
| Environment | Asset Variant | Host Example | Meta Description |
|---|---|---|---|
| Government | gov | go.gov.sg | Official Singapore government link shortener |
| Education | edu | for.edu.sg | Trusted short links from education institutions |
| Healthcare | health | for.sg | Trusted short links from healthcare institutions |
Sources: [webpack.config.ts:16-41], [README.md:52-56]
Layout and Styling
All pages use a BaseLayout which manages shared UI components.
- Masthead: Displays the official government banner (only for the
govvariant). - Sticky Header: A
BaseLayoutHeaderthat changes its sticky state based on the window's scroll position (triggers atscrollY >= 28). - Responsive Padding:
LandingGraphicSilveruses media queries to adjust padding multipliers for different screen widths (mobile: 0.5, medium: 1, desktop: 1.75).
Sources: [src/client/app/components/BaseLayout/index.tsx:75-104], [src/client/home/components/LandingGraphicSilver.tsx:88-100]
Summary
Landing and Transition pages provide the public-facing interface of GoGovSG. The Landing Page utilizes a variant-aware sliver system to deliver environment-specific branding and CTAs. The Transition Page serves as a critical safety buffer, using a 6-second timer and cookie-based persistence to balance security warnings with user convenience. Both systems are integrated within a responsive BaseLayout that ensures consistent header and footer behavior across the platform.