From d43f482d905dfe5c095c6cfc4305e0ca904ccc3e Mon Sep 17 00:00:00 2001 From: Dessalines Date: Fri, 13 Oct 2023 14:23:19 -0400 Subject: [PATCH] Fixing news titling. --- src/shared/components/news-item.tsx | 15 ++++++++------- src/shared/components/news.tsx | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/shared/components/news-item.tsx b/src/shared/components/news-item.tsx index c52621b..008317c 100644 --- a/src/shared/components/news-item.tsx +++ b/src/shared/components/news-item.tsx @@ -1,12 +1,9 @@ import { Component } from "inferno"; import { Helmet } from "inferno-helmet"; -import { i18n } from "../i18next"; import { news_md } from "../translations/news"; import { isBrowser, mdToHtml } from "../utils"; import { BottomSpacer } from "./common"; -const title = i18n.t("news"); - export class NewsItem extends Component { constructor(props: any, context: any) { super(props, context); @@ -18,17 +15,21 @@ export class NewsItem extends Component { } } - get markdown(): string { + get title(): string { let title = decodeURIComponent(this.props.match.params.title); title = title.replace(/_/g, " "); - return news_md.find(v => v.title == title)?.markdown ?? ""; + return title; + } + + get markdown(): string { + return news_md.find(v => v.title == this.title)?.markdown ?? ""; } render() { return (
- - + +
diff --git a/src/shared/components/news.tsx b/src/shared/components/news.tsx index b16b530..486ae21 100644 --- a/src/shared/components/news.tsx +++ b/src/shared/components/news.tsx @@ -58,7 +58,7 @@ const NewsCard = ({ news }: NewsProps) => (
- {title} + {news.title}
{news.dateStr}