Sometimes the directory structure where a post resides doesn't reflect the desired URL path for the given post.
Directory location:
/posts/my-post.md
Desired URL:
mysite.com/my-post/
In URL parlance, all of /posts/my-post is considered the "path". We can think of /posts/ as the "base path" for URL that's used by default. Therefore, we can introduce a basePath property to pages, which would then override everything before the file name in the resulting URL.
basePath should also work in _data.yaml so that it applies to all content within a directory subtree.
Sometimes the directory structure where a post resides doesn't reflect the desired URL path for the given post.
Directory location:
Desired URL:
In URL parlance, all of
/posts/my-post
is considered the "path". We can think of/posts/
as the "base path" for URL that's used by default. Therefore, we can introduce abasePath
property to pages, which would then override everything before the file name in the resulting URL.basePath
should also work in_data.yaml
so that it applies to all content within a directory subtree.