config ln array changed

This commit is contained in:
Al Murad Uzzaman
2024-05-16 17:11:25 +06:00
parent 97d6f22dcb
commit c137b8afcd
24 changed files with 200 additions and 362 deletions
+9 -6
View File
@@ -1,20 +1,23 @@
---
import config from "@/config/config.json";
import dateFormat from "@/lib/utils/dateFormat";
import { getLangFromUrl, getTranslations } from "@/lib/utils/i18nUtils";
import { humanize, plainify, slugify } from "@/lib/utils/textConverter";
import type { ContentEntryMap } from "astro:content";
import { FaRegFolder, FaRegUserCircle } from "react-icons/fa";
import ImageMod from "./ImageMod.astro";
import { getLangFromUrl } from "@/lib/utils/i18nUtils";
const {
summary_length,
blog_folder,
}: { summary_length: number; blog_folder: string } = config.settings;
const { defaultLang } = config.language;
const { data } = Astro.props;
const { title, image, date, author, categories } = data.data;
const lang = getLangFromUrl(Astro.url);
const path = Astro.url.pathname;
const { read_more } = await getTranslations(lang as keyof ContentEntryMap);
---
<div class="bg-body dark:bg-darkmode-body">
@@ -33,8 +36,8 @@ const path = Astro.url.pathname;
<h4 class="mb-3">
<a
href={path.includes("/categories")
? `/${lang === "en" ? "/" : lang}/blog/${data.slug}`
: `/${lang === "en" ? "/" : lang}/${data.slug}`}
? `${lang === defaultLang ? "" : `/${lang}`}/blog/${data.slug}`
: `${lang === defaultLang ? "" : `/${lang}`}/${data.slug}`}
>
{title}
</a>
@@ -63,9 +66,9 @@ const path = Astro.url.pathname;
<a
class="btn btn-outline-primary btn-sm"
href={path.includes("/categories")
? `/${lang === "en" ? "/" : lang}/blog/${data.slug}`
: `/${lang === "en" ? "/" : lang}/${data.slug}`}
? `${lang === defaultLang ? "" : `/${lang}`}/blog/${data.slug}`
: `${lang === defaultLang ? "" : `/${lang}`}/${data.slug}`}
>
read more
{read_more}
</a>
</div>
+6 -6
View File
@@ -1,15 +1,13 @@
---
import { supportedLang } from "@/lib/utils/i18nUtils";
import { humanize } from "@/lib/utils/textConverter";
import config from "@/config/config.json";
const { supported } = config.language;
const { className }: { className?: string } = Astro.props;
const paths = Astro.url.pathname.split("/").filter((x) => x);
let lang = "";
if (supported.includes(paths[0])) {
if (supportedLang.includes(paths[0])) {
lang = paths.shift()!;
}
@@ -17,7 +15,10 @@ let parts = [
{
label: "Home",
href: `/${lang}`,
"aria-label": Astro.url.pathname === `/${lang}` || Astro.url.pathname === `/${lang}/` ? "page" : undefined,
"aria-label":
Astro.url.pathname === `/${lang}` || Astro.url.pathname === `/${lang}/`
? "page"
: undefined,
},
];
@@ -30,7 +31,6 @@ paths.forEach((label: string, i: number) => {
"aria-label": Astro.url.pathname === href ? "page" : undefined,
});
});
---
<nav aria-label="Breadcrumb" class={className}>