diff --git a/default_environment/templates/html/blog_post_page.dust b/default_environment/templates/html/blog_post_page.dust
index 067b223..d846e3e 100644
--- a/default_environment/templates/html/blog_post_page.dust
+++ b/default_environment/templates/html/blog_post_page.dust
@@ -1,6 +1,6 @@
- {?.title}{?.self_link}
{.title}{:else}
{.title}
{/.self_link}{/.title}
+ {?.title}{?.self_link}
{.title}{:else}
{.title}
{/.self_link}{/.title}
{! TODO: date? !}
diff --git a/default_environment/templates/html/blog_stream.dust b/default_environment/templates/html/blog_stream.dust
index d0b5caf..97fe63c 100644
--- a/default_environment/templates/html/blog_stream.dust
+++ b/default_environment/templates/html/blog_stream.dust
@@ -2,7 +2,7 @@
{#.children}
- {?.title}{?.self_link}
{.title}{:else}
{.title}
{/.self_link}{/.title}
+ {?.title}{?.self_link}
{.title}{:else}
{.title}
{/.self_link}{/.title}
{! TODO: date? !}
diff --git a/src/command/build/render.rs b/src/command/build/render.rs
index de44026..6373398 100644
--- a/src/command/build/render.rs
+++ b/src/command/build/render.rs
@@ -77,8 +77,7 @@ impl SiteRenderer {
for blog_post_page in &blog_post.pages {
let output_path = self
.output_directory
- .join("posts")
- .join(&blog_post.id)
+ .join(config.get_relative_path_to_post(&blog_post.id))
.join(blog_post_page.get_output_path());
let convert_input = RenderBlogPostPageInput::new(blog_post, blog_post_page);
diff --git a/src/config/full.rs b/src/config/full.rs
index ce5ce3c..5fdfd1f 100644
--- a/src/config/full.rs
+++ b/src/config/full.rs
@@ -57,6 +57,15 @@ impl Config {
self.get_root_directory().join("posts")
}
+ /// Get the relative path to the folder containing a blog post.
+ ///
+ /// This could be appended to the output root directory to get the
+ /// blog post output folder or it could be used to generate a link
+ /// to the blog post.
+ pub(crate) fn get_relative_path_to_post
>(&self, post_id: P) -> PathBuf {
+ Path::new("posts").join(post_id)
+ }
+
pub(crate) fn get_output_directory(&self) -> PathBuf {
self.get_root_directory().join("output")
}
diff --git a/src/context/blog_stream.rs b/src/context/blog_stream.rs
index aefe096..28f6bb0 100644
--- a/src/context/blog_stream.rs
+++ b/src/context/blog_stream.rs
@@ -120,14 +120,13 @@ pub(crate) struct RenderBlogStreamEntry {
}
render!(RenderBlogStreamEntry, BlogPost, original, render_context, {
- // TODO: This link is probably wrong.
let link_to_blog_post = get_web_path(
render_context.config,
render_context.output_directory,
render_context.output_file,
render_context
- .output_file
- .strip_prefix(render_context.output_directory)?,
+ .config
+ .get_relative_path_to_post(&original.id),
)?;
// TODO: Should I guess an index page instead of erroring out?