Skip to main content

Important Disclaimer:
This is an open source template project and is not an official project of the United States Government. This was created as a weekend project to help developers build federally compliant websites more easily.

About this template:
This template helps developers create websites that follow the U.S. Web Design System (USWDS) standards. It provides a starting point for building accessible, mobile-friendly government websites. The template is released under the CC0 license, making it free to use, modify, and distribute.

View on GitHub: https://github.com/williamzujkowski/uswds-11ty-template

Quick Start Getting Started

From zero to a live government website in just a few commands. Follow our streamlined setup process to build your Section 508 compliant, USWDS-powered website.

Start Setup β†’

Get your federally compliant website up and running in 5 minutes

Quick Setup: If you're already familiar with Node.js and npm, jump directly to the Quick Start section below.

Prerequisites

Before you begin, ensure you have:

Node.js 18+

JavaScript runtime for building

node --version

Git

Version control system

git --version

Code Editor

VS Code recommended

code --version

Quick Start

  1. Create from Template

    Visit our GitHub repository and click the green "Use this template" button to create your own copy.

  2. Clone Your Repository

    git clone https://github.com/YOUR-USERNAME/YOUR-REPO.git
    cd YOUR-REPO
  3. Install Dependencies

    npm install
  4. Start Development Server

    npm start

    Your site is now running at http://localhost:8080

git clone https://github.com/williamzujkowski/uswds-11ty-template.git my-website
cd my-website
rm -rf .git
git init
npm install
npm start

Visit http://localhost:8080 to see your site!

  1. Download the template ZIP file
  2. Extract to your desired location
  3. Open terminal in the extracted folder
  4. Run: npm install
  5. Start: npm start

Your First Changes

🎯 Try It Now

  1. Edit the homepage: Open src/index.md in your editor
  2. Change the title: Update the hero heading to your agency name
  3. Save the file: Your browser will auto-refresh with changes
  4. Success! You've just edited your first page

Pro tip: Keep your browser and editor side-by-side to see changes instantly!

Essential Configuration

1. Update Site Information

Edit src/_data/site.json:

{
  "title": "Your Agency Name",
  "description": "Brief description of your agency",
  "url": "https://your-domain.gov",
  "author": "Your Agency",
  "email": "contact@your-agency.gov"
}

2. Customize Navigation

Also in src/_data/site.json:

{
  "navigation": {
    "primary": [
      { "text": "Home", "href": "/" },
      { "text": "About", "href": "/about/" },
      { "text": "Services", "href": "/services/" },
      { "text": "Contact", "href": "/contact/" }
    ]
  }
}

3. Create Your First Page

Create src/pages/about.md:

---
layout: layouts/page.njk
title: About Us
permalink: /about/
---

# About Our Agency

Your content here...

Available Commands

Development commands for building and testing your site
Command Description When to Use
npm start Start development server with live reload Daily development work
npm run build Create production-ready build Before deployment
npm run deploy Deploy to GitHub Pages Publishing updates
npm run test:a11y Run accessibility tests Before commits
npm run lint:js Check JavaScript code quality During development
npm run format Auto-format code with Prettier Before commits

Project Structure

your-website/
β”œβ”€β”€ src/                    # All source files
β”‚   β”œβ”€β”€ _data/             # Global data (site.json)
β”‚   β”œβ”€β”€ _includes/         # Templates and layouts
β”‚   β”œβ”€β”€ _styles/           # SCSS stylesheets
β”‚   β”œβ”€β”€ assets/            # Images, fonts, JS
β”‚   └── pages/             # Your content pages
β”œβ”€β”€ _site/                 # Built site (git-ignored)
β”œβ”€β”€ eleventy.config.js     # 11ty configuration
└── package.json           # Dependencies & scripts

Deployment Options

GitHub Pages (Free)

Perfect for public agency sites. Automatic deployment with included GitHub Actions.

  1. Push to GitHub
  2. Enable Pages in Settings
  3. Site deploys automatically

Cloud.gov / Federalist

Official government hosting platform with FedRAMP authorization and compliance.

  1. Apply for account
  2. Connect repository
  3. Configure build settings

Common Tasks

touch src/pages/services.md

Then add front matter to the file:

---
layout: layouts/page.njk
title: Our Services
permalink: /services/
---

Your content goes here…

Edit src/_styles/_custom.scss:

$theme-color-primary: #0f4c81;

.my-component {
background: color(β€˜primary-lighter’);
padding: units(2);
}

All USWDS components are available. Example alert:

<div class="usa-alert usa-alert--info">
  <div class="usa-alert__body">
    <h4 class="usa-alert__heading">Information</h4>
    <p class="usa-alert__text">Your message here.</p>
  </div>
</div>

View all components β†’

  1. Place image in src/assets/img/
  2. Reference in markdown: ![Alt text]({{ '/assets/img/image.jpg' | url }})
  3. Or in HTML: <img src="{{ '/assets/img/image.jpg' | url }}" alt="Description">

Troubleshooting

Common Issues & Quick Fixes

Installation Fails

npm cache clean --force
rm -rf node_modules package-lock.json
npm install

Port Already in Use

lsof -ti:8080
npx @11ty/eleventy --serve --port=3000

Changes Not Showing

  • Hard refresh browser (Ctrl+Shift+R)
  • Restart dev server
  • Check terminal for errors

Build Errors

  • Check Node version: node --version
  • Update dependencies: npm update
  • Enable debug: DEBUG=Eleventy* npm start

Next Steps

Explore Components

Browse all available USWDS components with live examples.

View Demo Sites

See complete example websites built with this template.

Best Practices

Learn accessibility, security, and performance guidelines.

Get Help

Support Resources