Skip to content

Way to get base relative path #3376

@jhwz

Description

@jhwz

Describe the problem

Recently there was a change that updated the $page store which moved the $page.path attribute to $page.url.pathname.
When running an app with paths.base set in svelte.config.js, this changed the properties of the path. Before, $page.path was relative to base set in the config. Now $page.url.pathname is always the full path.

If there was enough demand, it may make sense to make the relative path available through the framework.

Having more than one path may cause confusion to developers new to kit, and if this isn't a common use case it may not make sense.

Describe the proposed solution

Additional attribute path or relpath on the $page store

Alternatives considered

Its not a big deal to write $page.url.pathname.substring(base.length)

Importance

nice to have

Additional Information

No response

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