From 68c865c652afb04c7ad7d115419fe51d77555e22 Mon Sep 17 00:00:00 2001 From: Al Murad Uzzaman Date: Tue, 29 Apr 2025 11:13:55 +0600 Subject: [PATCH] ContentParser && Tabs Updated --- package.json | 20 ++++++++++---------- readme.md | 7 ++++--- src/layouts/components/ThemeSwitcher.astro | 2 +- src/layouts/shortcodes/Tabs.tsx | 4 ++-- src/lib/contentParser.astro | 16 +++++++++++++++- 5 files changed, 32 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index 9d8ed04..35122c0 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "astroplate", - "version": "5.5.0", + "version": "5.5.1", "description": "Astro and Tailwindcss boilerplate", "author": "zeon.studio", "license": "MIT", @@ -17,20 +17,20 @@ }, "dependencies": { "@astrojs/check": "0.9.4", - "@astrojs/mdx": "4.2.4", - "@astrojs/react": "4.2.4", + "@astrojs/mdx": "4.2.5", + "@astrojs/react": "4.2.5", "@astrojs/rss": "4.0.11", - "@astrojs/sitemap": "3.3.0", + "@astrojs/sitemap": "3.3.1", "@digi4care/astro-google-tagmanager": "^1.4.0", - "@justinribeiro/lite-youtube": "^1.7.1", - "astro": "5.7.4", + "@justinribeiro/lite-youtube": "^1.8.0", + "astro": "5.7.8", "astro-auto-import": "^0.4.4", "astro-font": "^1.1.0", "date-fns": "^4.1.0", "disqus-react": "^1.1.6", "github-slugger": "^2.0.0", "gray-matter": "^4.0.3", - "marked": "^15.0.8", + "marked": "^15.0.11", "prop-types": "^15.8.1", "react": "^19.1.0", "react-dom": "^19.1.0", @@ -38,16 +38,16 @@ "remark-collapse": "^0.1.2", "remark-toc": "^9.0.0", "swiper": "^11.2.6", - "vite": "^6.3.2" + "vite": "^6.3.3" }, "devDependencies": { "@tailwindcss/forms": "^0.5.10", "@tailwindcss/typography": "^0.5.16", "@tailwindcss/vite": "^4.1.4", - "@types/node": "22.14.1", + "@types/node": "22.15.3", "@types/react": "19.1.2", "@types/react-dom": "19.1.2", - "eslint": "^9.25.0", + "eslint": "^9.25.1", "prettier": "^3.5.3", "prettier-plugin-astro": "^0.14.1", "prettier-plugin-tailwindcss": "^0.6.11", diff --git a/readme.md b/readme.md index 0fd6ca3..0b32044 100755 --- a/readme.md +++ b/readme.md @@ -10,8 +10,8 @@

- - Astro Version 5.5 + + Astro Version 5.7 @@ -35,6 +35,7 @@ - 📞 Support contact form - 📱 Fully responsive - 📝 Write and update content in Markdown / MDX +- 📎 Google Tag Manager - 💬 Disqus Comment - 🔳 Syntax Highlighting @@ -66,7 +67,7 @@ ### 📦 Dependencies -- astro v5.5+ +- astro v5.7+ - node v20.10+ - yarn v1.22+ - tailwind v4+ diff --git a/src/layouts/components/ThemeSwitcher.astro b/src/layouts/components/ThemeSwitcher.astro index 2f10b2c..9aa9357 100755 --- a/src/layouts/components/ThemeSwitcher.astro +++ b/src/layouts/components/ThemeSwitcher.astro @@ -3,7 +3,7 @@ import config from "@/config/config.json"; const { theme_switcher, - default_theme, + // default_theme, }: { theme_switcher: boolean; default_theme: string } = config.settings; const { className }: { className?: string } = Astro.props; --- diff --git a/src/layouts/shortcodes/Tabs.tsx b/src/layouts/shortcodes/Tabs.tsx index 448443c..dcd6fe2 100644 --- a/src/layouts/shortcodes/Tabs.tsx +++ b/src/layouts/shortcodes/Tabs.tsx @@ -16,8 +16,8 @@ const Tabs = ({ children }: { children: React.ReactElement }) => { }, [active]); const tabLinks = Array.from( - children.props.value.matchAll( - /]*>(.*?)<\/div>/gs, + (children.props as any).value.matchAll( + /]*>((?:.|\n)*?)<\/div>/g, ), (match: RegExpMatchArray) => ({ name: match[1], children: match[0] }), ); diff --git a/src/lib/contentParser.astro b/src/lib/contentParser.astro index 85685c8..fc1654a 100644 --- a/src/lib/contentParser.astro +++ b/src/lib/contentParser.astro @@ -5,12 +5,26 @@ import { type CollectionKey, } from "astro:content"; +type PageData = { + title: string; + meta_title?: string; + description?: string; + image?: string; + draft?: boolean; +}; + export const getSinglePage = async ( collectionName: C ): Promise[]> => { const allPages = await getCollection(collectionName); + const removeIndex = allPages.filter((data) => data.id.match(/^(?!-)/)); - const removeDrafts = removeIndex.filter((data) => !data.data.draft); + + const removeDrafts = removeIndex.filter((data) => { + const pageData = data.data as PageData; + return pageData.draft !== true; + }); + return removeDrafts; }; ---