Skip to content
Back to skills

Vitepress Spa Routing

ASecurity

VitePress intercepts all navigation clicks for SPA routing:

  • 4 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 3, 2026
ai-agentsjavascriptgojava

Works with

  • cli

Security analysis

A100/100

Scanned September 3, 2026

npx -y skills add fabioc-aloha/Alex_Skill_Mall --skill vitepress-spa-routing --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Vitepress Spa Routing?

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

Security grade badge for Vitepress Spa Routing
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/fabioc-aloha-vitepress-spa-routing/badge)](https://www.skillsdirectory.com/skills/fabioc-aloha-vitepress-spa-routing)

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-spa-routing
description: "VitePress intercepts all navigation clicks for SPA routing:"
lastReviewed: 2026-04-30
---

# VitePress SPA Routing

## The Problem

VitePress intercepts all navigation clicks for SPA routing:

```html
<!-- This link will be handled by VitePress router -->
<a href="/external-app/">External App</a>

<!-- VitePress fetches /external-app/index.md instead of navigating -->
```

This breaks:

- Links to non-VitePress pages in the same domain
- Links to static HTML files
- Links to other apps hosted at subpaths

## The Solution

### Option 1: target="_self" (Force Full Navigation)

```javascript
// In .vitepress/config.js
nav: [
  { 
    text: 'External App', 
    link: '/app/',
    target: '_self'  // Forces full page navigation
  }
]
```

### Option 2: External Link

```javascript
nav: [
  { 
    text: 'External App', 
    link: 'https://same-domain.com/app/' // Full URL bypasses router
  }
]
```

### Option 3: Iframe Embed (See vitepress-iframe-embed skill)

For standalone HTML that should appear within VitePress layout.

## When Each Applies

| Scenario | Solution |
|----------|----------|
| Link to different app on same domain | `target: "_self"` |
| Link to truly external site | Full URL |
| Embed external content in VitePress layout | Iframe pattern |
| Link to static HTML file | `target: "_self"` |

## In Markdown

```markdown
<!-- Bad: VitePress intercepts -->
[Go to app](/app/)

<!-- Good: Force navigation -->
<a href="/app/" target="_self">Go to app</a>

<!-- Also good: Full URL -->
[Go to app](https://example.com/app/)
```

## Verification

1. Click the link
2. Browser should do full page load (network tab shows document request)
3. URL bar shows target URL (not VitePress route)

## When to Apply

- Multi-app deployments on same domain
- Static HTML files alongside VitePress
- Links to server-rendered pages

## Tags

`vitepress` `spa` `routing` `navigation`

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.

Comments

Loading comments…

Newsletter

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