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 {
3131impl Post {
3232 pub ( crate ) fn open ( path : & Path , manifest : & Manifest ) -> eyre:: Result < Self > {
3333 // 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+ } ;
3545
3646 let contents = std:: fs:: read_to_string ( path) ?;
3747
You can’t perform that action at this time.
0 commit comments