Building Sites

This guide covers best practices for building effective, maintainable, and performant sites with the Serverless CMS.

Site Architecture

Planning Your Site Structure

Before creating pages, plan your site structure:

  1. Define page hierarchy: Identify top-level pages and their children
  2. Choose page types: Determine which page types you need (Page, Article, Blog, custom)
  3. Design templates: Create templates for each page type
  4. Identify components: List the components you'll need

Example structure:

/ (Home)

├── /about

│ ├── /about/team

│ └── /about/history

├── /services

│ ├── /services/consulting

│ └── /services/development

├── /blog

│ ├── /blog/post-1

│ ├── /blog/post-2

│ └── /blog/post-3

└── /contact

URL Structure Best Practices

  • Keep URLs short: /about not /about-our-company
  • Use hyphens: /our-services not /our_services or /ourservices
  • Avoid deep nesting: Limit to 2-3 levels maximum
  • Be consistent: Use the same pattern throughout the site
  • Plan for growth: Leave room for future pages

Template Design

Template Patterns

Standard Page Template

For general content pages:

Fixed Area: Header (logo, navigation)

Content Zone: Main Content

Fixed Area: Footer (copyright, links)

Use for: About, Services, Contact pages

Article Template

For news articles and blog posts:

Fixed Area: Header

Content Zone: Article Header (title, date, author)

Content Zone: Article Content

Content Zone: Related Articles

Fixed Area: Footer

Use for: Blog posts, news articles, case studies

Landing Page Template

For marketing and campaign pages:

Content Zone: Hero

Content Zone: Features

Content Zone: Testimonials

Content Zone: Call to Action

Fixed Area: Footer (minimal)

Use for: Product pages, campaign pages, event pages

Template Best Practices

  • Consistent headers/footers: Use fixed areas for elements that appear on every page
  • Flexible content zones: Provide enough zones for varied content
  • Logical flow: Order zones in a natural reading order
  • Mobile-first: Design templates for mobile, then enhance for desktop
  • Accessibility: Use semantic HTML and proper heading hierarchy

Component Strategy

Component Selection

Choose the right components for your needs:

Component
Use Case
Title
Page headings, section titles
Rich Text
Paragraphs, formatted content
Image
Photos, graphics, illustrations
Button
Calls to action, links
Teaser
Content previews, cards
Container
Layout structure, grouping
Header
Site header, navigation
Site Navigation
Navigation menus
Page List
Dynamic page listings

Component Composition

Build pages by composing components:

Example: About Page

  1. Title: "About Our Company"
  2. Rich Text: Company description
  3. Image: Team photo
  4. Rich Text: Mission statement
  5. Teaser (×3): Team member profiles
  6. Button: "Join Our Team"

Custom Components

Create custom components when:

  • Built-in components don't meet your needs
  • You need specialized functionality
  • You want consistent branding across pages
  • You need to integrate with external services

Examples:

  • Product showcase
  • Pricing table
  • Contact form
  • Video player
  • Map embed

Design System

Establishing Design Variables

Define a consistent design system:

Color Palette

--color-primary: #3b82f6; /* Brand blue */

--color-secondary: #8b5cf6; /* Brand purple */

--color-accent: #f59e0b; /* Accent orange */

--color-background: #ffffff; /* White */

--color-text: #1f2937; /* Dark grey */

Typography Scale

--font-family-base: 'Inter', sans-serif;

--font-family-heading: 'Inter', sans-serif;

--font-size-base: 16px;

--font-size-lg: 18px;

--font-size-xl: 20px;

--font-size-2xl: 24px;

Spacing Scale

--spacing-xs: 4px;

--spacing-sm: 8px;

--spacing-md: 16px;

--spacing-lg: 24px;

--spacing-xl: 32px;

--spacing-2xl: 48px;

Applying the Design System

  1. Set site theme: Configure design variables in site settings
  2. Use in components: Reference variables in component CSS
  3. Document standards: Create a style guide for content editors
  4. Maintain consistency: Review pages regularly for consistency

Content Strategy

Content Guidelines

Establish content guidelines for your team:

Writing Style

  • Tone: Professional, friendly, conversational
  • Voice: Active voice, second person ("you")
  • Length: Concise, scannable paragraphs
  • Formatting: Use headings, lists, and emphasis

SEO Guidelines

  • Titles: 50-60 characters, include target keyword
  • Descriptions: 150-160 characters, compelling and descriptive
  • Headings: Use H1 for page title, H2-H6 for sections
  • Alt text: Descriptive, include keywords naturally

Accessibility Guidelines

  • Images: Always include alt text
  • Links: Use descriptive link text ("Read our guide" not "Click here")
  • Headings: Use proper heading hierarchy
  • Color: Ensure sufficient contrast (WCAG AA: 4.5:1)

Content Workflow

Establish a content workflow:

  1. Draft: Author creates content
  2. Review: Editor reviews for quality, SEO, accessibility
  3. Revise: Author makes requested changes
  4. Approve: Editor approves for publishing
  5. Publish: User with publish permissions publishes
  6. Monitor: Track performance and update as needed

Performance Optimization

Image Optimization

  • Format: Use WebP for photos, SVG for graphics
  • Size: Resize images to display size (don't rely on CSS scaling)
  • Compression: Compress images to reduce file size
  • Alt text: Always include descriptive alt text

Recommended sizes:

  • Hero images: 1920×1080 (or 16:9 ratio)
  • Content images: 1200×800 (or 3:2 ratio)
  • Thumbnails: 400×300 (or 4:3 ratio)

Component Performance

  • Minimize components: Use only necessary components
  • Avoid nesting: Don't nest containers unnecessarily
  • Optimize CSS: Remove unused styles
  • Limit animations: Use animations sparingly

Caching Strategy

The CMS uses aggressive caching:

  • Static HTML: Cached with max-age=31536000, immutable
  • CDN: CloudFront caches content globally
  • Rebuild: Rebuild site to clear cache and apply changes

Responsive Design

Mobile-First Approach

Design for mobile first, then enhance for larger screens:

  1. Start with mobile: Design for 320px width
  2. Add tablet styles: Enhance for 768px+ width
  3. Add desktop styles: Enhance for 1024px+ width

Breakpoint Strategy

Use platform breakpoints:

/* Mobile: 0-767px (default styles) */

.component {

  padding: var(--spacing-md);

}

 

/* Tablet: 768px+ */

@media (min-width: var(--bp-tablet)) {

  .component {

    padding: var(--spacing-lg);

  }

}

 

/* Desktop: 1024px+ */

@media (min-width: var(--bp-desktop)) {

  .component {

    padding: var(--spacing-xl);

  }

}

Testing Responsive Design

Test on multiple devices:

  • Mobile: iPhone, Android phones (320-414px)
  • Tablet: iPad, Android tablets (768-1024px)
  • Desktop: Laptops, monitors (1280px+)

Use browser dev tools to test responsive behavior.

Accessibility

WCAG Compliance

Follow WCAG 2.1 Level AA guidelines:

Perceivable

  • Alt text: Provide alt text for all images
  • Color contrast: Ensure 4.5:1 contrast ratio for text
  • Text sizing: Allow text to scale to 200%

Operable

  • Keyboard navigation: All interactive elements keyboard accessible
  • Focus indicators: Visible focus indicators on all interactive elements
  • Skip links: Provide skip-to-content links

Understandable

  • Clear language: Use plain language
  • Consistent navigation: Keep navigation consistent across pages
  • Error messages: Provide clear, helpful error messages

Robust

  • Semantic HTML: Use appropriate HTML elements
  • Valid HTML: Ensure HTML validates
  • ARIA: Use ARIA attributes when semantic HTML is insufficient

Testing Accessibility

  • Keyboard: Navigate using only keyboard (Tab, Enter, Escape)
  • Screen reader: Test with NVDA (Windows) or VoiceOver (Mac)
  • Automated tools: Use axe DevTools or WAVE
  • Manual review: Review for logical structure and clarity

Security Best Practices

Content Security

  • Sanitization: HTML is automatically sanitized on upload
  • XSS prevention: Variable markers are HTML-encoded
  • Input validation: All user input is validated

Access Control

  • Principle of least privilege: Grant minimum necessary permissions
  • Regular audits: Review user access quarterly
  • Deactivate promptly: Remove access when users leave

Monitoring

  • Review logs: Monitor CloudWatch logs for suspicious activity
  • Track changes: Review page version history
  • Monitor crawlers: Track AI crawler activity

Maintenance

Regular Tasks

Weekly

  • Review new content: Check recently published pages
  • Monitor analytics: Review page views and crawler activity
  • Check for errors: Review error logs

Monthly

  • Update components: Check for component updates
  • Review permissions: Audit user access
  • Backup verification: Verify backups are working

Quarterly

  • Content audit: Review all pages for accuracy and relevance
  • Performance review: Check site performance metrics
  • Security review: Review security settings and access logs
  • Design review: Ensure design consistency across pages

Updating Content

When updating existing content:

  1. Review current content: Understand what's currently published
  2. Make changes: Edit in the page editor
  3. Preview: Check the live preview
  4. Test: Verify links, images, and formatting
  5. Publish: Publish the updated page
  6. Verify: Check the live page

Rebuilding Sites

Rebuild your site when:

  • Theme changes: After updating design variables
  • Template changes: After modifying templates
  • Component updates: After uploading new component versions
  • Periodic maintenance: Monthly or quarterly

Troubleshooting

Common Issues

Pages Not Updating

Cause: CDN cache not cleared

Solution:

  1. Perform a site rebuild
  2. Wait 5-10 minutes for CDN cache to clear
  3. Hard refresh browser (Ctrl+Shift+R or Cmd+Shift+R)

Inconsistent Styling

Cause: Design variables not applied

Solution:

  1. Check site theme settings
  2. Rebuild site to apply variables
  3. Clear browser cache

Broken Links

Cause: Page slug changed or page deleted

Solution:

  1. Update links to use correct slugs
  2. Restore deleted pages if needed
  3. Set up redirects (contact administrator)

Related Topics