Skip to content
Back to skills

Vitepress Clean Urls

ASecurity

With `cleanUrls: true`, nav links must NOT have `.html` extensions:

  • 6 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 3, 2026
ai-agentsjavascriptgojavabashapi

Works with

  • api

Security analysis

A100/100

Scanned September 3, 2026

npx -y skills add fabioc-aloha/Alex_Skill_Mall --skill vitepress-clean-urls --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Vitepress Clean Urls?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Vitepress Clean Urls
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/fabioc-aloha-vitepress-clean-urls/badge)](https://www.skillsdirectory.com/skills/fabioc-aloha-vitepress-clean-urls)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: vitepress-clean-urls
description: "With `cleanUrls: true`, nav links must NOT have `.html` extensions:"
lastReviewed: 2026-04-30
---

# VitePress Clean URLs

## The Problem

With `cleanUrls: true`, nav links must NOT have `.html` extensions:

```javascript
// vitepress.config.js
export default {
  cleanUrls: true  // URLs become /guide/intro instead of /guide/intro.html
}
```

```javascript
// Bad: will 404
nav: [
  { text: 'Guide', link: '/guide/intro.html' }  // Wrong!
]

// Also bad in markdown
[Read more](/guide/intro.html)  // Wrong!
```

## The Solution

When `cleanUrls: true`, use extensionless paths everywhere.

```javascript
// Good
nav: [
  { text: 'Guide', link: '/guide/intro' }
]

sidebar: [
  { text: 'Introduction', link: '/guide/intro' }
]
```

```markdown
<!-- In markdown files -->
[Read more](/guide/intro)
[See API](/api/methods)
```

## Common Gotchas

| Pattern | cleanUrls: false | cleanUrls: true |
|---------|------------------|-----------------|
| Nav links | `/guide.html` | `/guide` |
| Sidebar links | `/api/foo.html` | `/api/foo` |
| Markdown links | `[text](./page.html)` | `[text](./page)` |
| External links | Unchanged | Unchanged |

## Migration Script

```javascript
// scripts/remove-html-extensions.cjs
const glob = require('glob');
const fs = require('fs');

glob.sync('docs/**/*.md').forEach(file => {
  let content = fs.readFileSync(file, 'utf8');
  // Replace .html) with ) and .html] with ]
  content = content.replace(/\.html\)/g, ')');
  content = content.replace(/\.html\]/g, ']');
  fs.writeFileSync(file, content);
});
```

## Verification

```bash
# Find remaining .html links
grep -rn '\.html[)\]]' docs/

# Should return nothing
```

## When to Apply

- Enabling `cleanUrls: true` in existing project
- Migrating from other static site generators
- Any VitePress project setup

## Tags

`vitepress` `urls` `configuration` `links`

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.