changed the content folder structure && fixed breadcrumps

This commit is contained in:
Al Murad Uzzaman
2024-05-23 15:39:53 +06:00
parent 521fd4804d
commit d5e012e6f8
54 changed files with 295 additions and 60 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ export async function getStaticPaths() {
supportedLang.map(async (lang) => {
const pages = await getSinglePage("pages", lang as keyof ContentEntryMap);
return pages.map((page: any) => ({
return pages.map((page) => ({
params: {
lang: lang || undefined,
regular: page.slug.split("/").pop(),
+2 -5
View File
@@ -4,7 +4,7 @@ import Base from "@/layouts/Base.astro";
import { getListPage } from "@/lib/contentParser.astro";
import { supportedLang } from "@/lib/utils/languageParser";
import { markdownify } from "@/lib/utils/textConverter";
import type { ContentCollectionKey, ContentEntryMap } from "astro:content";
import type { ContentEntryMap } from "astro:content";
export function getStaticPaths() {
const paths = supportedLang.map((lang) => ({
@@ -14,10 +14,7 @@ export function getStaticPaths() {
}
const { lang } = Astro.params;
const about: any = await getListPage(
"about" as ContentCollectionKey,
lang as keyof ContentEntryMap
);
const about = await getListPage("about", lang as keyof ContentEntryMap);
const { Content } = await about[0].render();
const { title, description, meta_title, image } = about[0].data;
+3 -3
View File
@@ -14,12 +14,12 @@ export async function getStaticPaths() {
const paths = await Promise.all(
supportedLang.map(async (lang) => {
const authors: any = await getSinglePage(
const authors = await getSinglePage(
COLLECTION_FOLDER,
lang as keyof ContentEntryMap
);
return authors.map((author: any) => ({
return authors.map((author) => ({
params: {
lang: lang || undefined,
single: author.slug.split("/").pop(),
@@ -42,7 +42,7 @@ const { Content } = await author.render();
const BLOG_FOLDER = "blog";
const posts = await getSinglePage(BLOG_FOLDER, lang as keyof ContentEntryMap);
const postFilterByAuthor = posts.filter(
(post: any) => slugify(post.data.author) === slugify(title)
(post) => slugify(post.data.author) === slugify(title)
);
---
+1 -1
View File
@@ -16,7 +16,7 @@ export function getStaticPaths() {
}
const { lang } = Astro.params;
const authorIndex: any = await getListPage(
const authorIndex = await getListPage(
COLLECTION_FOLDER,
lang as keyof ContentEntryMap
);
+2 -2
View File
@@ -10,12 +10,12 @@ export async function getStaticPaths() {
const paths = await Promise.all(
supportedLang.map(async (lang) => {
const posts: any = await getSinglePage(
const posts = await getSinglePage(
BLOG_FOLDER,
lang as keyof ContentEntryMap
);
return posts.map((post: any) => ({
return posts.map((post) => ({
params: {
lang: lang || undefined,
single: post.slug.split("/").pop(),
+1 -1
View File
@@ -19,7 +19,7 @@ export function getStaticPaths() {
}
const { lang } = Astro.params;
const BLOG_FOLDER = "blog";
const postIndex: any = await getListPage(
const postIndex = await getListPage(
BLOG_FOLDER,
lang as keyof ContentEntryMap
);
+1 -5
View File
@@ -4,7 +4,6 @@ import Base from "@/layouts/Base.astro";
import { getListPage } from "@/lib/contentParser.astro";
import { getTranslations, supportedLang } from "@/lib/utils/languageParser";
import PageHeader from "@/partials/PageHeader.astro";
import type { CollectionKey } from "astro:content";
import { type ContentEntryMap } from "astro:content";
export function getStaticPaths() {
@@ -15,10 +14,7 @@ export function getStaticPaths() {
}
const { lang } = Astro.params;
const contact: any = await getListPage(
"contact" as CollectionKey,
lang as keyof ContentEntryMap
);
const contact = await getListPage("contact", lang as keyof ContentEntryMap);
const { contact_form_action }: { contact_form_action: string } = config.params;
const { title, description, meta_title, image } = contact[0].data;
+10 -20
View File
@@ -6,18 +6,9 @@ import { supportedLang } from "@/lib/utils/languageParser";
import { markdownify } from "@/lib/utils/textConverter";
import CallToAction from "@/partials/CallToAction.astro";
import Testimonial from "@/partials/Testimonial.astro";
import type { Button, Feature } from "@/types";
import type { ContentCollectionKey, ContentEntryMap } from "astro:content";
import type { Feature } from "@/types";
import type { ContentEntryMap } from "astro:content";
import { FaCheck } from "react-icons/fa";
interface Homepage {
banner: {
title: string;
content: string;
image: string;
button: Button;
};
features: Feature[];
}
export function getStaticPaths() {
const paths = supportedLang.map((lang) => ({
@@ -27,20 +18,19 @@ export function getStaticPaths() {
}
const { lang } = Astro.params;
const homepage: any = await getListPage(
"homepage" as ContentCollectionKey,
lang as keyof ContentEntryMap
);
const { banner, features }: Homepage = homepage[0].data;
const homepage = await getListPage("homepage", lang as keyof ContentEntryMap);
const { banner, features } = homepage[0].data;
const testimonial = await getSinglePage(
"sections/testimonial" as ContentCollectionKey,
lang as keyof ContentEntryMap
"sections",
lang as keyof ContentEntryMap,
"testimonial"
);
const call_to_action = await getSinglePage(
"sections/call-to-action" as ContentCollectionKey,
lang as keyof ContentEntryMap
"sections",
lang as keyof ContentEntryMap,
"call-to-action"
);
---