Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First document at root should not have special meaning when routing #18016

Open
wants to merge 1 commit into
base: v15/dev
Choose a base branch
from

Conversation

kjac
Copy link
Contributor

@kjac kjac commented Jan 17, 2025

Prerequisites

  • I have added steps to test this contribution in the description below

Description

The first root document has been given special meaning when routing content. I can't find any background for this, nor any reasoning why it should have.

Specifics

Given this document structure:

image

All the blog posts are routable both at their expected path /[blog post URL segment]/, but also at /posts/[blog post URL segment]/. The latter should not be the case - at least not by default (more on that below).

image

image

For comparison, the authors are not routable at /authors/[author URL segment]/ - only at /[author URL segment]/, as expected.

HideTopLevelNodeFromPath

The HideTopLevelNodeFromPath config setting (see docs) is by default true ... setting it to false should include the root document URL segment in the blog post and author paths - and this does work for both blog posts and authors:

image

image

Testing this PR

Verify that V15 routes documents like V13 - with and without HideTopLevelNodeFromPath enabled.

Note: root documents are always routable by their URL segment even with HideTopLevelNodeFromPath - this is consistent with the V13 behaviour.

Copy link
Contributor

@AndyButland AndyButland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested this and seems good to me.

I setup as follows:

image

And got the following, expected results:

V13

With "HideTopLevelNodeFromPath": true:

/home/test-1 - does not route
/test-1 - routes
/home-2/test-2 - does not route
/test-2 - routes

With "HideTopLevelNodeFromPath": false:

/home/test-1 - routes
/test-1 - does not route
/home-2/test-2 - routes
/test-2 - does not route

V15 - Before PR

With "HideTopLevelNodeFromPath": true:

/home/test-1 - routes
/test-1 - routes
/home-2/test-2 - does not route
/test-2 - routes

With "HideTopLevelNodeFromPath": false:

/home/test-1 - routes
/test-1 - does not route
/home-2/test-2 - routes
/test-2 - does not route

V15 - After PR

With "HideTopLevelNodeFromPath": true:

/home/test-1 - does not route
/test-1 - routes
/home-2/test-2 - does not route
/test-2 - routes

With "HideTopLevelNodeFromPath": false:

/home/test-1 - routes
/test-1 - does not route
/home-2/test-2 - routes
/test-2 - does not route

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants