File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,17 @@ pub struct Post {
31
31
impl Post {
32
32
pub ( crate ) fn open ( path : & Path , manifest : & Manifest ) -> eyre:: Result < Self > {
33
33
// yeah this might blow up, but it won't
34
- let filename = path. file_name ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) . into ( ) ;
34
+ let filename = {
35
+ let filename = path. file_name ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) . to_string ( ) ;
36
+ // '@' is used as a disambiguator between file names that were
37
+ // previously identical except for the date prefix (which was
38
+ // removed). The URL doesn't need the disambiguator, because it has
39
+ // the date in it. Also, we must remove it to preserve permalinks.
40
+ match filename. split_once ( '@' ) {
41
+ Some ( ( pre, _) ) => format ! ( "{pre}.md" ) ,
42
+ None => filename,
43
+ }
44
+ } ;
35
45
36
46
let contents = std:: fs:: read_to_string ( path) ?;
37
47
You can’t perform that action at this time.
0 commit comments