diff --git a/src/shared/components/news-item.tsx b/src/shared/components/news-item.tsx index 09e5b58..2cb0c68 100644 --- a/src/shared/components/news-item.tsx +++ b/src/shared/components/news-item.tsx @@ -19,6 +19,7 @@ export class NewsItem extends Component { get markdown(): string { let title = decodeURIComponent(this.props.match.params.title); + title = title.replace(/_/g, " "); return news_md.find(v => v.title == title).markdown; } diff --git a/src/shared/components/news.tsx b/src/shared/components/news.tsx index 84b1c78..7139da2 100644 --- a/src/shared/components/news.tsx +++ b/src/shared/components/news.tsx @@ -30,7 +30,7 @@ export class News extends Component { @@ -39,3 +39,7 @@ export class News extends Component { ); } } + +function titleToUrl(title: string): string { + return title.replace(/ /g, "_"); +} diff --git a/src/shared/routes.ts b/src/shared/routes.ts index 610ddcf..8d664a4 100644 --- a/src/shared/routes.ts +++ b/src/shared/routes.ts @@ -31,7 +31,7 @@ export const routes: IRouteProps[] = [ component: Releases, }, { - path: `/news_item/:title`, + path: `/news/:title`, exact: true, component: NewsItem, },