Analogjs Development
Development guide for Analogjs 2.x framework with file-based routing and content management.
When to Use This Skill
- •Creating new pages (*.page.ts)
- •Setting up dynamic routes ([param].page.ts)
- •Loading and displaying markdown content
- •Configuring SSR/SSG (prerender)
- •Creating API routes (server/routes/)
When NOT to use:
- •Creating non-page Angular components →
angular-v21-development - •Styling only →
tailwindcss-v4-styling - •UI/UX design application →
material-design-3-expressive
Core Principles
- •File-Based Routing: Routes are defined by file location and naming
- •Default Export: Page components must use default export
- •Content Resources API: Use
injectContentFiles()andinjectContent()for markdown - •requestContextInterceptor: Place as the last interceptor in HttpClient configuration
- •Project Structure:
code
src/ ├── app/pages/ # File-based routing │ ├── index.page.ts # / route │ ├── about/ │ │ └── index.page.ts # /about route │ └── blog/ │ ├── index.page.ts # /blog route │ └── [slug].page.ts # /blog/:slug dynamic route ├── content/ # Markdown content │ └── blog/ └── server/routes/ # API endpoints
Implementation Guidelines
Page Component
Key patterns for page components:
- •File must end with
.page.tssuffix - •Component must be default exported
- •Can have accompanying
.page.htmland.page.cssfiles
→ Details: Routing Patterns
Dynamic Routes
Dynamic route patterns:
- •Use bracket syntax for parameter:
[slug].page.ts - •Access parameter via
injectContent()orActivatedRoute - •Prefer
withComponentInputBinding()for route params as inputs
→ Details: Routing Patterns
Content Management
Markdown content handling patterns:
- •Use
injectContentFiles<T>()for content list - •Use
injectContent<T>()for single content by route param - •Define
PostAttributesinterface for content metadata - •Configure
provideContent()with markdown renderer
→ Details: Content Handling
Route Metadata
Route-level configuration patterns:
- •Export
routeMetafor route configuration - •Set page title, meta tags, guards
- •Configure SSR/SSG options per route
→ Details: Routing Patterns
SSR/SSG Configuration
Server-side rendering and static generation patterns:
- •Configure
prerender.routesinvite.config.ts - •Use
contentDirwithtransformfor dynamic content routes - •Set up
provideServerContext()inmain.server.ts
→ Details: Content Handling
API Routes
Server API route patterns:
- •Create files in
src/server/routes/ - •Use
defineEventHandler()from h3 - •File path becomes API endpoint
→ Details: Routing Patterns
Workflow
- •Route Planning: Determine route type (static/dynamic/group)
- •Create Page File: Create
*.page.tswith correct naming - •Template Setup: Create template/style files if needed
- •Content Connection: Set up markdown content loading if applicable
- •Route Metadata: Configure
routeMetaexport - •Prerender Setup: Add route to prerender configuration for SSG
Related Skills
- •angular-v21-development: For component internal implementation
- •tailwindcss-v4-styling: For page styling
- •material-design-3-expressive: For UI component application
Reference Documentation
For detailed patterns and code examples, see:
- •Routing Patterns - File-based routing details
- •Content Handling - Markdown content management