From 760aa4f164743241e816c9683f7100a066e3744c Mon Sep 17 00:00:00 2001 From: "ildar.timerbaev" Date: Thu, 21 Nov 2024 19:48:57 +0300 Subject: [PATCH] Fixed the feed page's metadata --- .../_helpers/generate-feed-metadata.ts | 7 ++-- src/utils/get-meta-props.ts | 33 ------------------- src/utils/index.ts | 1 - 3 files changed, 5 insertions(+), 36 deletions(-) delete mode 100644 src/utils/get-meta-props.ts diff --git a/src/app/(dynamicPages)/feed/[...sections]/_helpers/generate-feed-metadata.ts b/src/app/(dynamicPages)/feed/[...sections]/_helpers/generate-feed-metadata.ts index 73277ae59..843bbbf98 100644 --- a/src/app/(dynamicPages)/feed/[...sections]/_helpers/generate-feed-metadata.ts +++ b/src/app/(dynamicPages)/feed/[...sections]/_helpers/generate-feed-metadata.ts @@ -10,8 +10,11 @@ export async function generateFeedMetadata(filter: string, tag: string) { let canonical = `${defaults.base}/${filter}`; let rss = ""; - if (tag) { - title = `latest #${tag.replace("%40", "@ ")} ${filter} topics on internet`; + if (tag.startsWith("%40")) { + title = `${tag.replace("%40", "@")} ${filter} on decentralized web – Ecency`; + description = i18next.t("entry-index.description-user-feed", { u: tag }); + } else if (tag) { + title = `latest #${tag} ${filter} topics on internet`; description = i18next.t("entry-index.description-tag", { f: fC, t: tag }); url = `/${filter}/${tag}`; diff --git a/src/utils/get-meta-props.ts b/src/utils/get-meta-props.ts deleted file mode 100644 index efd2360a6..000000000 --- a/src/utils/get-meta-props.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { capitalize } from "./capitalize"; -import defaults from "@/defaults.json"; -import i18next from "i18next"; - -export function getMetaProps>({ activeUser, filter, tag }: T) { - const fC = capitalize(filter); - let title = i18next.t("entry-index.title", { f: fC }); - let description = i18next.t("entry-index.description", { f: fC }); - let url = `/${filter}`; - let canonical = `${defaults.base}/${filter}`; - let rss = ""; - - if (tag) { - if (activeUser && tag === "my") { - title = `@${activeUser.username}'s community feed on decentralized web`; - description = i18next.t("entry-index.description-user-feed", { u: tag }); - canonical = `${defaults.base}/@${tag}/${filter}`; - } else if (tag.startsWith("@")) { - title = `${tag}'s ${filter} on decentralized web`; - description = i18next.t("entry-index.description-user-feed", { u: tag }); - canonical = `${defaults.base}/@${tag}/${filter}`; - } else { - title = `latest #${tag} ${filter} topics on internet`; - description = i18next.t("entry-index.description-tag", { f: fC, t: tag }); - - url = `/${filter}/${tag}`; - canonical = `${defaults.base}/${filter}/${tag}`; - rss = `${defaults.base}/${filter}/${tag}/rss.xml`; - } - } - - return { title, description, url, canonical, rss }; -} diff --git a/src/utils/index.ts b/src/utils/index.ts index 5c90fe5f3..b5b15111b 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -27,7 +27,6 @@ export * from "./input-util"; export * from "./use-stopwatch"; export * from "./is-mobile"; export * from "./spk-estimated-balance"; -export * from "./get-meta-props"; export * from "./use-nav"; export * from "./b64"; export * from "./currency-symbol";