pub fn derive_output_rel_path(content_rel_source_path: &str) -> StringExpand description
Maps a content-relative markdown source path to the site-relative
output path staticdatagen’s compiler will write for it.
Mirrors the compiler’s convention exactly (locked by tests below):
staticdatagen 0.0.9 (src/utilities/write.rs,
get_processed_file_name + write_files_to_build_directory)
writes foo.md to <build>/foo/index.html and index.md to the
build root’s index.html. The same mapping is documented on
derive_url in src/plugins/isr_manifest.rs
(posts/foo.md → /posts/foo/index.html, index.md → /index.html,
about/index.md → /about/index.html).
Only the .md extension is stripped — matching both the compiler
and the ISR manifest — so a .markdown file keeps its full name
as the directory segment, exactly as staticdatagen would emit it.
§Examples
use ssg::urls::derive_output_rel_path;
assert_eq!(derive_output_rel_path("index.md"), "index.html");
assert_eq!(derive_output_rel_path("foo.md"), "foo/index.html");
assert_eq!(
derive_output_rel_path("posts/foo.md"),
"posts/foo/index.html"
);
assert_eq!(
derive_output_rel_path("about/index.md"),
"about/index.html"
);