Skip to main content

derive_permalink

Function derive_permalink 

Source
pub fn derive_permalink(base_url: &str, content_rel_source_path: &str) -> String
Expand description

Derives the canonical permalink for a content-relative markdown source path: derive_output_rel_path piped into derive_page_url.

This is the value the content stager injects as permalink: when a page’s front matter carries neither permalink nor url (spec A2/B1, plan §2 item 1.2, issue #586).

§Examples

use ssg::urls::derive_permalink;

assert_eq!(
    derive_permalink("https://example.com", "posts/foo.md"),
    "https://example.com/posts/foo/"
);
assert_eq!(
    derive_permalink("https://example.com/", "index.md"),
    "https://example.com/"
);