diff --git a/src/config/config.json b/src/config/config.json index 396aa11..d3b4957 100755 --- a/src/config/config.json +++ b/src/config/config.json @@ -12,10 +12,6 @@ "logo_text": "Astroplate" }, - "language": { - "defaultLang": "en" - }, - "settings": { "search": true, "sticky_header": true, diff --git a/src/config/menu.json b/src/config/menu.json deleted file mode 100755 index 3502218..0000000 --- a/src/config/menu.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "main": [ - { - "name": "Home", - "url": "/" - }, - { - "name": "About", - "url": "/about" - }, - { - "name": "Elements", - "url": "/elements" - }, - { - "name": "Pages", - "url": "", - "hasChildren": true, - "children": [ - { - "name": "Contact", - "url": "/contact" - }, - { - "name": "Blog", - "url": "/blog" - }, - { - "name": "Authors", - "url": "/authors" - }, - { - "name": "Categories", - "url": "/categories" - }, - { - "name": "Tags", - "url": "/tags" - }, - { - "name": "404 Page", - "url": "/404" - } - ] - } - ], - "footer": [ - { - "name": "Elements", - "url": "/elements" - }, - { - "name": "Privacy Policy", - "url": "/privacy-policy" - } - ] -} diff --git a/src/layouts/PostSingle.astro b/src/layouts/PostSingle.astro index 2eedbec..3efce71 100755 --- a/src/layouts/PostSingle.astro +++ b/src/layouts/PostSingle.astro @@ -1,19 +1,25 @@ --- import BlogCard from "@/components/BlogCard.astro"; import Share from "@/components/Share.astro"; +import config from "@/config/config.json"; import Disqus from "@/helpers/Disqus"; import { getSinglePage } from "@/lib/contentParser.astro"; import dateFormat from "@/lib/utils/dateFormat"; 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 } = config.settings; const COLLECTION_FOLDER = "blog"; const { post } = Astro.props; const { lang } = Astro.params; -const posts = await getSinglePage(COLLECTION_FOLDER); +const posts = await getSinglePage( + COLLECTION_FOLDER, + lang as keyof ContentEntryMap, +); const similarPosts = similarItems(post, posts); const { Content } = await post.render(); const { title, description, author, categories, image, date, tags } = post.data; @@ -40,7 +46,9 @@ const { title, description, author, categories, image, date, tags } = post.data;
{plainify(data.body?.slice(0, Number(summary_length)))}
{read_more} diff --git a/src/layouts/helpers/LanguageSwitcher.tsx b/src/layouts/helpers/LanguageSwitcher.tsx index 5f279b3..a5464dd 100644 --- a/src/layouts/helpers/LanguageSwitcher.tsx +++ b/src/layouts/helpers/LanguageSwitcher.tsx @@ -1,32 +1,42 @@ +import config from "@/config/config.json"; import languages from "@/config/language.json"; -import React from 'react'; +import React from "react"; -const LanguageSwitcher = ({ lang, pathname }: { lang: string; pathname: string }) => { +const LanguageSwitcher = ({ + lang, + pathname, +}: { + lang: string; + pathname: string; +}) => { + const { default_language } = config.settings; - return ( -