You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
EDIT:
In addition to the details below, the term basePath is probably being mis-used. Typically, a basePath refers to something added, not removed. A website might be deployed such that all pages sit under an added path that the source code doesn't know about, e.g., GitHub pages adds a path: github.com/my-org/posts/hello-world/. The basePath in this case would be my-org/.
The behavior that currently exists in basePath is more like a path rewrite. We should better reflect this distinction.
The basePath property can be applied to a page to replace the page's directory location with the given basePath. This is useful, for example, if all blog posts are stored under source/posts/ but you don't want the posts/ to appear in the URL.
The basePath property can be defined in a _data.yaml file to easily change the base path for all pages in that directory. However, due to data inheritance, this approach doesn't work as expected for pages deeper within the directory hierarchy.
Example 1:
Imagine that the example above needed to group more than just one file for hello-world:
source/
posts/
hello-world/
index.md
header.png
In the above case, we'd still want the url to be mydomain.com/hello-world/ but instead we get mydomain.com/index.html. This is because the hello-world/ is now a directory, which is treated as part of the URL path, and is replaced by the basePath of /.
Example 2:
Imagine that we have a multi-level hierarchy of posts, which should legitimately have a hierarchy of URLs, but we want to remove
the top level posts path:
By default, the hello-world.md page would deploy to mydomain/posts/news/hello-world/, but we'd like it to appear at mydomain/news/hello-world/.
Technically, this goal could be a achieved by setting the basePath in news/, trending/, and archive/ instead of under posts/. However, this only moves the problem one level deeper.
Instead, the more appropriate thing to do is have basePath apply to whatever level in the directory system where its defined, but then not effect any pages or assets lower down in the directory hierarchy.
The text was updated successfully, but these errors were encountered:
EDIT:
In addition to the details below, the term
basePath
is probably being mis-used. Typically, abasePath
refers to something added, not removed. A website might be deployed such that all pages sit under an added path that the source code doesn't know about, e.g., GitHub pages adds a path:github.com/my-org/posts/hello-world/
. ThebasePath
in this case would bemy-org/
.The behavior that currently exists in
basePath
is more like a path rewrite. We should better reflect this distinction.The
basePath
property can be applied to a page to replace the page's directory location with the givenbasePath
. This is useful, for example, if all blog posts are stored undersource/posts/
but you don't want theposts/
to appear in the URL./source/posts/hello-world.md
->mydomain.com/hello-world/
The
basePath
property can be defined in a_data.yaml
file to easily change the base path for all pages in that directory. However, due to data inheritance, this approach doesn't work as expected for pages deeper within the directory hierarchy.Example 1:
Imagine that the example above needed to group more than just one file for
hello-world
:In the above case, we'd still want the url to be
mydomain.com/hello-world/
but instead we getmydomain.com/index.html
. This is because thehello-world/
is now a directory, which is treated as part of the URL path, and is replaced by thebasePath
of/
.Example 2:
Imagine that we have a multi-level hierarchy of posts, which should legitimately have a hierarchy of URLs, but we want to remove
the top level
posts
path:By default, the
hello-world.md
page would deploy tomydomain/posts/news/hello-world/
, but we'd like it to appear atmydomain/news/hello-world/
.Technically, this goal could be a achieved by setting the
basePath
innews/
,trending/
, andarchive/
instead of underposts/
. However, this only moves the problem one level deeper.Instead, the more appropriate thing to do is have
basePath
apply to whatever level in the directory system where its defined, but then not effect any pages or assets lower down in the directory hierarchy.The text was updated successfully, but these errors were encountered: