Skip to content

Cache cleanup for moved pages leaves stale files #114

@luandro

Description

@luandro

Problem

When a page moves from one section to another (e.g., /docs/intro.md to /docs/getting-started/intro.md):

  • The new file is created ✓
  • The old file is NOT automatically deleted ✗
  • The cache accumulates both paths in outputPaths

Current Behavior

Stale files remain on disk after pages are reorganized, causing:

  • Disk space accumulation
  • Potential duplicate content in builds
  • Manual cleanup required

Example Scenario

  1. Page intro.md initially outputs to build/intro.html
  2. Page moves sections, now outputs to build/getting-started/intro.html
  3. Old file build/intro.html remains on disk
  4. Cache now tracks both paths

Potential Fix

Add logic to detect when a page's expected path differs from all cached paths, and clean up the old files. This could involve:

  • Tracking the 'current' vs 'stale' output paths
  • Implementing a cleanup routine during cache invalidation
  • Detecting orphaned files during build time

Related

Related to cache path normalization and detection improvements

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions