Flutter-Bounty-Hunters / static_shock

A static site generator for Dart.
MIT License
59 stars 5 forks source link

[Shock] - Add a basePath to alter URL path regardless of directories #88

Closed matthew-carroll closed 2 months ago

matthew-carroll commented 2 months ago

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.