diff --git a/src/layouts/PostSingle.astro b/src/layouts/PostSingle.astro index f4a95f1..9042b08 100755 --- a/src/layouts/PostSingle.astro +++ b/src/layouts/PostSingle.astro @@ -4,15 +4,14 @@ import Share from "@/components/Share.astro"; import config from "@/config/config.json"; import Disqus from "@/helpers/Disqus"; import { getSinglePage } from "@/lib/contentParser.astro"; +import { slugSelector } from "@/lib/languageParser.astro"; import dateFormat from "@/lib/utils/dateFormat"; -import { constructUrl } from "@/lib/utils/i18nUtils"; import similarItems from "@/lib/utils/similarItems"; import { humanize, markdownify, slugify } from "@/lib/utils/textConverter"; import type { ContentEntryMap } from "astro:content"; import { FaRegClock, FaRegFolder, FaRegUserCircle } from "react-icons/fa"; import ImageMod from "./components/ImageMod.astro"; -const { default_language, default_language_in_path } = config.settings; -const { trailing_slash } = config.site; +const { default_language } = config.settings; const COLLECTION_FOLDER = "blog"; const { post } = Astro.props; @@ -24,29 +23,11 @@ if (!lang) { const posts = await getSinglePage( COLLECTION_FOLDER, - lang as keyof ContentEntryMap, + lang as keyof ContentEntryMap ); const similarPosts = similarItems(post, posts); const { Content } = await post.render(); const { title, description, author, categories, image, date, tags } = post.data; - -const constructLocalizedUrl = (url: string) => { - if (lang === default_language) { - return constructUrl( - default_language_in_path ? `/${lang}${url}` : url, - lang, - default_language, - trailing_slash, - ); - } else { - return constructUrl( - url, - lang as keyof ContentEntryMap, - default_language, - trailing_slash, - ); - } -}; ---
@@ -70,7 +51,7 @@ const constructLocalizedUrl = (url: string) => {