From 5c03211dfe9b367d32831288c2770f7fdcce7004 Mon Sep 17 00:00:00 2001 From: Al Murad Uzzaman Date: Fri, 17 May 2024 18:25:14 +0600 Subject: [PATCH] tags pages added --- src/config/config.json | 4 -- src/config/menu.json | 57 ----------------- src/layouts/PostSingle.astro | 14 +++- src/layouts/components/AuthorCard.astro | 5 +- src/layouts/components/BlogCard.astro | 26 ++++---- src/layouts/helpers/LanguageSwitcher.tsx | 64 +++++++++++-------- src/layouts/partials/Footer.astro | 5 +- src/lib/contentParser.astro | 16 ++--- src/lib/taxonomyParser.astro | 18 ++++-- src/lib/utils/i18nUtils.ts | 12 ++-- src/pages/404.astro | 11 ++-- src/pages/[...lang]/about.astro | 7 +- .../[...lang]/categories/[category].astro | 5 +- src/pages/[...lang]/categories/index.astro | 2 +- src/pages/[...lang]/index.astro | 23 ++++--- src/pages/[...lang]/tags/[tag].astro | 56 ++++++++++++++++ src/pages/[...lang]/tags/index.astro | 48 ++++++++++++++ 17 files changed, 229 insertions(+), 144 deletions(-) delete mode 100755 src/config/menu.json create mode 100644 src/pages/[...lang]/tags/[tag].astro create mode 100644 src/pages/[...lang]/tags/index.astro 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;