
Security News
curl Shuts Down Bug Bounty Program After Flood of AI Slop Reports
A surge of AI-generated vulnerability reports has pushed open source maintainers to rethink bug bounties and tighten security disclosure processes.
nuxt-github-pages
Advanced tools
Nuxt module to fix trailing slash issues for GitHub Pages deployments
Nuxt module to fix trailing slash issues when deploying to GitHub Pages. This module ensures your static Nuxt site works correctly with GitHub Pages' file resolution behavior.
When deploying a Nuxt 3 static site to GitHub Pages:
/docs/page works fine initially/docs/page/ returns a 404 error/docs/page.html but GitHub Pages expects /docs/page/index.htmlThis module automatically creates duplicate HTML files during the build process. For every /path/index.html, it creates a /path.html file, ensuring URLs work with or without trailing slashes.
# npm
npm install nuxt-github-pages
# pnpm
pnpm add nuxt-github-pages
# yarn
yarn add nuxt-github-pages
# bun
bun add nuxt-github-pages
Add nuxt-github-pages to the modules section of nuxt.config.ts:
export default defineNuxtConfig({
modules: ['nuxt-github-pages']
})
That's it! The module will automatically run during nuxt generate.
You can configure the module by adding options:
export default defineNuxtConfig({
modules: ['nuxt-github-pages'],
githubPages: {
// Enable or disable the module (default: true)
enabled: true,
// Directories to check for output files (default: ['dist', '.output/public'])
outputDirs: ['dist', '.output/public'],
// Show verbose logging (default: true)
verbose: true,
// Add canonical URLs to prevent duplicate content SEO issues (default: true)
canonicalUrls: true,
// Use trailing slashes in canonical URLs (default: false)
trailingSlash: false,
// Create duplicate HTML files to avoid redirects (default: true)
createDuplicates: true
}
})
enabledbooleantrueoutputDirsstring[]['dist', '.output/public']verbosebooleantruecanonicalUrlsbooleantruetrailingSlashbooleanfalsefalse, canonical URLs will be /path. When true, they will be /path/. Choose based on your site's URL structure preference.createDuplicatesbooleantruetrue, creates both /path/index.html and /path.html. Set to false if you only need canonical URLs without file duplication (e.g., for other hosting platforms or if you handle redirects differently).⚠️ Warning: Setting this to false will cause 404 errors on GitHub Pages for URLs without trailing slashes.
nuxt generate build process, this module hooks into the prerender:done eventindex.html filesindex.html found at /path/to/page/index.html, it creates a duplicate at /path/to/page.html/path/to/page and /path/to/page/ resolve correctly on GitHub PagesGiven this generated structure:
dist/
├── index.html
├── about/
│ └── index.html
├── docs/
│ ├── index.html
│ └── getting-started/
│ └── index.html
The module creates these additional files:
dist/
├── about.html ← Created
├── docs.html ← Created
├── docs/
│ └── getting-started.html ← Created
After building with nuxt generate, deploy the output directory to GitHub Pages as usual:
# Build your site
pnpm run generate
# Deploy to GitHub Pages (example using gh-pages)
npx gh-pages -d dist
.html filesWhile you could use a custom post-build script, this module:
Netlify-specific _redirects only work on Netlify. This module works everywhere.
These require server configuration access, which you don't have with GitHub Pages.
We use GitHub Actions for all production releases to ensure consistency and security.
# Using our convenience script
./scripts/release-prod.sh patch # For bug fixes
./scripts/release-prod.sh minor # For new features
./scripts/release-prod.sh major # For breaking changes
# Or directly with GitHub CLI
gh workflow run release.yml --field version_type=patch --field create_github_release=true
Add a release label to your PR before merging:
release:patch - Bug fixesrelease:minor - New featuresrelease:major - Breaking changesThe release will trigger automatically when the PR is merged.
# Test the release process without making changes
./scripts/release.sh patch --dry-run
# After a release, always sync your local repository
git pull origin main --tags
For more details, see CONTRIBUTING.md.
By default, this module injects canonical URLs to prevent duplicate content issues. Both /path and /path/ will point to the same canonical URL, telling search engines which version is preferred.
<!-- Both pages will have the same canonical URL -->
<!-- Default (trailingSlash: false): -->
<link rel="canonical" href="/about">
<!-- With trailingSlash: true: -->
<link rel="canonical" href="/about/">
You can customize this behavior:
export default defineNuxtConfig({
modules: ['nuxt-github-pages'],
githubPages: {
// Disable canonical URLs entirely
canonicalUrls: false,
// Or use trailing slashes in canonical URLs
trailingSlash: true // Results in href="/path/"
}
})
These recommendations are based on the excellent Trailing Slash Guide by Sébastien Lorber, which provides comprehensive testing and documentation of trailing slash behavior across all major hosting platforms. If you're dealing with trailing slash issues, his guide is an invaluable resource.
GitHub Pages redirects /about to /about/ on refresh, indicating it prefers trailing slashes:
export default defineNuxtConfig({
modules: ['nuxt-github-pages'],
githubPages: {
canonicalUrls: true,
trailingSlash: true // URLs like /about/ (with trailing slash)
}
})
Netlify's "Pretty URLs" feature (enabled by default) prefers trailing slashes for directory-based content:
export default defineNuxtConfig({
modules: ['nuxt-github-pages'],
githubPages: {
canonicalUrls: true,
trailingSlash: true // URLs like /about/ (with trailing slash)
}
})
Cloudflare Pages automatically adds trailing slashes and creates redirects:
export default defineNuxtConfig({
modules: ['nuxt-github-pages'],
githubPages: {
canonicalUrls: true,
trailingSlash: true // URLs like /about/ (with trailing slash)
}
})
Vercel is configurable but defaults to no trailing slashes:
export default defineNuxtConfig({
modules: ['nuxt-github-pages'],
githubPages: {
canonicalUrls: true,
trailingSlash: false // URLs like /about (no trailing slash)
}
})
If you're managing canonical URLs through other means (like useHead or SEO modules):
export default defineNuxtConfig({
modules: ['nuxt-github-pages'],
githubPages: {
canonicalUrls: false // Don't inject any canonical URLs
}
})
nuxt generate (not nuxt build)nitro.preset is set to 'static' (this is the default for nuxt generate)outputDirsverbose: true to see detailed loggingIf you use a custom output directory, add it to the configuration:
export default defineNuxtConfig({
modules: ['nuxt-github-pages'],
githubPages: {
outputDirs: ['my-custom-dist', 'dist', '.output/public']
}
})
# Run tests
pnpm run test
# Run tests in watch mode
pnpm run test:watch
See test/README.md for detailed information about the testing approach and patterns used in this module.
See test/TEST_MATRIX.md for current test coverage.
We welcome contributions! Please see our Contributing Guide for details on:
# Setup
pnpm install
pnpm run dev:prepare
# Before committing
pnpm run test:all
This project uses GitHub Actions for continuous integration and deployment:
release:patch, release:minor, or release:major labels trigger automatic releases when mergedSee .github/SETUP.md for workflow configuration details.
# Install dependencies
pnpm install
# Generate type stubs
pnpm run dev:prepare
# Develop with the playground
pnpm run dev
# Build the playground
pnpm run dev:build
# Run ESLint
pnpm run lint
# Run type checking
pnpm run test:types
# Clean build artifacts
pnpm run clean
# Run ALL checks (recommended before committing)
pnpm run test:all
# Release new version
pnpm run release
pnpm install and pnpm run dev:preparepnpm run dev to test changes in the playgroundpnpm run test:all to ensure everything passespnpm run clean to remove build artifactsThis project uses git hooks to maintain code quality:
pnpm run test:all - Complete test suite (install → prepare → test → lint → type check → clean)pnpm run clean - Remove all build artifacts (preserves node_modules)./scripts/pre-release.sh - Run all checks and build before releasingpnpm run test:all before pushing changesSee NOTICE.md for additional copyright and license information.
For security issues, please see our Security Policy.
This project adheres to the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code.
This module was created to solve the long-standing trailing slash issue when deploying Nuxt sites to GitHub Pages.
Created by MITRE for the open source community.
FAQs
Nuxt module to fix trailing slash issues for GitHub Pages deployments
We found that nuxt-github-pages demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
A surge of AI-generated vulnerability reports has pushed open source maintainers to rethink bug bounties and tighten security disclosure processes.

Product
Scan results now load faster and remain consistent over time, with stable URLs and on-demand rescans for fresh security data.

Product
Socket's new Alert Details page is designed to surface more context, with a clearer layout, reachability dependency chains, and structured review.