mirror of
https://github.com/LemmyNet/joinlemmy-site.git
synced 2024-11-22 20:31:17 +00:00
Fixing news titling.
This commit is contained in:
parent
3d6972cee9
commit
d43f482d90
2 changed files with 9 additions and 8 deletions
|
@ -1,12 +1,9 @@
|
||||||
import { Component } from "inferno";
|
import { Component } from "inferno";
|
||||||
import { Helmet } from "inferno-helmet";
|
import { Helmet } from "inferno-helmet";
|
||||||
import { i18n } from "../i18next";
|
|
||||||
import { news_md } from "../translations/news";
|
import { news_md } from "../translations/news";
|
||||||
import { isBrowser, mdToHtml } from "../utils";
|
import { isBrowser, mdToHtml } from "../utils";
|
||||||
import { BottomSpacer } from "./common";
|
import { BottomSpacer } from "./common";
|
||||||
|
|
||||||
const title = i18n.t("news");
|
|
||||||
|
|
||||||
export class NewsItem extends Component<any, any> {
|
export class NewsItem extends Component<any, any> {
|
||||||
constructor(props: any, context: any) {
|
constructor(props: any, context: any) {
|
||||||
super(props, context);
|
super(props, context);
|
||||||
|
@ -18,17 +15,21 @@ export class NewsItem extends Component<any, any> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get markdown(): string {
|
get title(): string {
|
||||||
let title = decodeURIComponent(this.props.match.params.title);
|
let title = decodeURIComponent(this.props.match.params.title);
|
||||||
title = title.replace(/_/g, " ");
|
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() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div className="container mx-auto px-4">
|
<div className="container mx-auto px-4">
|
||||||
<Helmet title={title}>
|
<Helmet title={this.title}>
|
||||||
<meta property={"title"} content={title} />
|
<meta property={"title"} content={this.title} />
|
||||||
</Helmet>
|
</Helmet>
|
||||||
<div className="flex flex-col items-center pt-16">
|
<div className="flex flex-col items-center pt-16">
|
||||||
<article className="prose prose-a:text-primary prose-h1:text-primary">
|
<article className="prose prose-a:text-primary prose-h1:text-primary">
|
||||||
|
|
|
@ -58,7 +58,7 @@ const NewsCard = ({ news }: NewsProps) => (
|
||||||
<div className="md:col-span-10">
|
<div className="md:col-span-10">
|
||||||
<div className="md:flex md:flex-row md:items-baseline md:space-x-3">
|
<div className="md:flex md:flex-row md:items-baseline md:space-x-3">
|
||||||
<Link to={news.url} className={`text-2xl ${TEXT_GRADIENT}`}>
|
<Link to={news.url} className={`text-2xl ${TEXT_GRADIENT}`}>
|
||||||
{title}
|
{news.title}
|
||||||
</Link>
|
</Link>
|
||||||
<div className="text-sm text-gray-500">{news.dateStr}</div>
|
<div className="text-sm text-gray-500">{news.dateStr}</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue