File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -167,7 +167,7 @@ export const routes = [
167
167
component : PostsRoot ,
168
168
} ,
169
169
{
170
- path : '/post/:issueNumber' ,
170
+ path : '/post/:issueNumber/:slug? ' ,
171
171
exact : true ,
172
172
strict : false ,
173
173
query : postRootQuery ,
Original file line number Diff line number Diff line change @@ -344,17 +344,24 @@ export const ReactionBar = ({
344
344
) ;
345
345
} ;
346
346
347
+ function slugify ( s : string ) : string {
348
+ return lowerCase ( s ) . replace ( / [ ^ A - Z a - z 0 - 9 - ] + / g, '-' ) ;
349
+ }
350
+
347
351
export function postUrl ( {
348
352
post,
349
353
viewComments,
350
354
} : {
351
355
post : {
352
356
+ number : number ,
353
357
+ repository : { + owner : { + login : string } , + name : string } ,
358
+ + title : string ,
354
359
} ,
355
360
viewComments ? : boolean ,
356
361
} ) {
357
- return `/post/${ post . number } ${ viewComments ? '#comments' : '' } ` ;
362
+ return `/post/${ post . number } /${ slugify ( post . title ) } ${
363
+ viewComments ? '#comments' : ''
364
+ } `;
358
365
}
359
366
360
367
const Post = ( { relay, post} : Props ) => {
You can’t perform that action at this time.
0 commit comments