Fix the links to the blog posts.
This commit is contained in:
		
							parent
							
								
									add267d616
								
							
						
					
					
						commit
						261fe8a1a2
					
				| @ -1,6 +1,6 @@ | ||||
| <div class="blog_post"> | ||||
|   <div class="blog_post_intro"> | ||||
|     {?.title}{?.self_link}<a class="blog_post_title" href="{.link}">{.title}</a>{:else}<div class="blog_post_title">{.title}</div>{/.self_link}{/.title} | ||||
|     {?.title}{?.self_link}<a class="blog_post_title" href="{.self_link}">{.title}</a>{:else}<div class="blog_post_title">{.title}</div>{/.self_link}{/.title} | ||||
|     {! TODO: date? !} | ||||
|   </div> | ||||
| 
 | ||||
|  | ||||
| @ -2,7 +2,7 @@ | ||||
|   {#.children} | ||||
|     <div class="blog_stream_post"> | ||||
|       <div class="blog_post_intro"> | ||||
|         {?.title}{?.self_link}<a class="blog_post_title" href="{.link}">{.title}</a>{:else}<div class="blog_post_title">{.title}</div>{/.self_link}{/.title} | ||||
|         {?.title}{?.self_link}<a class="blog_post_title" href="{.self_link}">{.title}</a>{:else}<div class="blog_post_title">{.title}</div>{/.self_link}{/.title} | ||||
|         {! TODO: date? !} | ||||
|       </div> | ||||
| 
 | ||||
|  | ||||
| @ -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); | ||||
|  | ||||
| @ -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<P: AsRef<Path>>(&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") | ||||
|     } | ||||
|  | ||||
| @ -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?
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Tom Alexander
						Tom Alexander