mirror of
https://github.com/10h30/astroplate.git
synced 2026-07-16 13:13:26 +09:00
config ln array changed
This commit is contained in:
+13
-9
@@ -1,17 +1,21 @@
|
||||
---
|
||||
import Base from "@/layouts/Base.astro";
|
||||
import config from "@/config/config.json";
|
||||
import { getLangFromUrl, useTranslations } from "@/lib/utils/i18nUtils";
|
||||
import Base from "@/layouts/Base.astro";
|
||||
import { getLangFromUrl, getTranslations } from "@/lib/utils/i18nUtils";
|
||||
import type { ContentEntryMap } from "astro:content";
|
||||
import { supportedLang } from "@/lib/utils/i18nUtils";
|
||||
|
||||
export function getStaticPaths() {
|
||||
const {supported} = config.language;
|
||||
const paths = supported.map((lang) => ({ params: { lang: lang || undefined } }));
|
||||
const paths = supportedLang.map((lang) => ({
|
||||
params: { lang: lang || undefined },
|
||||
}));
|
||||
return paths;
|
||||
}
|
||||
|
||||
const lang = getLangFromUrl(Astro.url);
|
||||
const t = useTranslations(lang as any);
|
||||
const {defaultLang} = config.language;
|
||||
const { page_not_found_content, page_not_found, back_to_home } =
|
||||
await getTranslations(lang as keyof ContentEntryMap);
|
||||
const { defaultLang } = config.language;
|
||||
const href = lang && lang !== defaultLang ? `/${lang}/` : "/";
|
||||
---
|
||||
|
||||
@@ -25,11 +29,11 @@ const href = lang && lang !== defaultLang ? `/${lang}/` : "/";
|
||||
>
|
||||
404
|
||||
</span>
|
||||
<h1 class="h2 mb-4">{t("page_not_found")}</h1>
|
||||
<h1 class="h2 mb-4">{page_not_found}</h1>
|
||||
<div class="content">
|
||||
<p>{t("page_not_found_content")}</p>
|
||||
<p>{page_not_found_content}</p>
|
||||
</div>
|
||||
<a href={href} class="btn btn-primary mt-8">{t("back_to_home")}</a>
|
||||
<a href={href} class="btn btn-primary mt-8">{back_to_home}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
---
|
||||
import config from "@/config/config.json";
|
||||
import Base from "@/layouts/Base.astro";
|
||||
import { getSinglePage } from "@/lib/contentParser.astro";
|
||||
import { supportedLang } from "@/lib/utils/i18nUtils";
|
||||
import PageHeader from "@/partials/PageHeader.astro";
|
||||
import type { ContentEntryMap } from "astro:content";
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const { supported } = config.language;
|
||||
|
||||
const paths = await Promise.all(
|
||||
supported.map(async (lang) => {
|
||||
supportedLang.map(async (lang) => {
|
||||
const pages = await getSinglePage("pages", lang as keyof ContentEntryMap);
|
||||
|
||||
return pages.map((page) => ({
|
||||
|
||||
@@ -1,20 +1,19 @@
|
||||
---
|
||||
import ImageMod from "@/components/ImageMod.astro";
|
||||
import Base from "@/layouts/Base.astro";
|
||||
import { markdownify } from "@/lib/utils/textConverter";
|
||||
import type { ContentEntryMap } from "astro:content";
|
||||
import { getCollection } from "astro:content";
|
||||
import config from "@/config/config.json";
|
||||
import { getListPage } from "@/lib/contentParser.astro";
|
||||
import { supportedLang } from "@/lib/utils/i18nUtils";
|
||||
import { markdownify } from "@/lib/utils/textConverter";
|
||||
|
||||
export function getStaticPaths() {
|
||||
const {supported} = config.language;
|
||||
const paths = supported.map((lang) => ({ params: { lang: lang || undefined } }));
|
||||
const paths = supportedLang.map((lang) => ({
|
||||
params: { lang: lang || undefined },
|
||||
}));
|
||||
return paths;
|
||||
}
|
||||
|
||||
const { lang } = Astro.params;
|
||||
const about = await getListPage("about", lang as keyof ContentEntryMap);
|
||||
const about = await getListPage("about", lang);
|
||||
|
||||
const { Content } = await about[0].render();
|
||||
const { title, description, meta_title, image } = about[0].data;
|
||||
|
||||
@@ -2,21 +2,22 @@
|
||||
import BlogCard from "@/components/BlogCard.astro";
|
||||
import ImageMod from "@/components/ImageMod.astro";
|
||||
import Social from "@/components/Social.astro";
|
||||
import config from "@/config/config.json";
|
||||
import Base from "@/layouts/Base.astro";
|
||||
import { getSinglePage } from "@/lib/contentParser.astro";
|
||||
import { supportedLang } from "@/lib/utils/i18nUtils";
|
||||
import { slugify } from "@/lib/utils/textConverter";
|
||||
import type { ContentEntryMap } from "astro:content";
|
||||
import { getCollection } from "astro:content";
|
||||
|
||||
// get all static paths for authors
|
||||
export async function getStaticPaths() {
|
||||
const { supported } = config.language;
|
||||
const COLLECTION_FOLDER = "authors";
|
||||
|
||||
const paths = await Promise.all(
|
||||
supported.map(async (lang) => {
|
||||
const authors = await getSinglePage(COLLECTION_FOLDER, lang as keyof ContentEntryMap);
|
||||
supportedLang.map(async (lang) => {
|
||||
const authors = await getSinglePage(
|
||||
COLLECTION_FOLDER,
|
||||
lang as keyof ContentEntryMap
|
||||
);
|
||||
|
||||
return authors.map((author) => ({
|
||||
params: {
|
||||
@@ -25,7 +26,7 @@ export async function getStaticPaths() {
|
||||
},
|
||||
props: {
|
||||
author,
|
||||
lang
|
||||
lang,
|
||||
},
|
||||
}));
|
||||
})
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
---
|
||||
import AuthorCard from "@/components/AuthorCard.astro";
|
||||
import config from "@/config/config.json";
|
||||
import Base from "@/layouts/Base.astro";
|
||||
import { getListPage, getSinglePage } from "@/lib/contentParser.astro";
|
||||
import { supportedLang } from "@/lib/utils/i18nUtils";
|
||||
import PageHeader from "@/partials/PageHeader.astro";
|
||||
import { type ContentEntryMap } from "astro:content";
|
||||
|
||||
const COLLECTION_FOLDER = "authors";
|
||||
|
||||
export function getStaticPaths() {
|
||||
const { supported } = config.language;
|
||||
const paths = supported.map((lang) => ({
|
||||
const paths = supportedLang.map((lang) => ({
|
||||
params: { lang: lang || undefined },
|
||||
}));
|
||||
return paths;
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
---
|
||||
import config from "@/config/config.json";
|
||||
import Base from "@/layouts/Base.astro";
|
||||
import PostSingle from "@/layouts/PostSingle.astro";
|
||||
import { getSinglePage } from "@/lib/contentParser.astro";
|
||||
import { supportedLang } from "@/lib/utils/i18nUtils";
|
||||
import type { ContentEntryMap } from "astro:content";
|
||||
import { getCollection } from "astro:content";
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const { supported } = config.language;
|
||||
const BLOG_FOLDER = "blog";
|
||||
|
||||
const paths = await Promise.all(
|
||||
supported.map(async (lang) => {
|
||||
const posts = await getSinglePage(BLOG_FOLDER, lang as keyof ContentEntryMap);
|
||||
supportedLang.map(async (lang) => {
|
||||
const posts = await getSinglePage(
|
||||
BLOG_FOLDER,
|
||||
lang as keyof ContentEntryMap
|
||||
);
|
||||
|
||||
return posts.map((post) => ({
|
||||
params: {
|
||||
@@ -31,6 +32,7 @@ export async function getStaticPaths() {
|
||||
const { post } = Astro.props;
|
||||
const { title, meta_title, description, image } = post.data;
|
||||
---
|
||||
|
||||
<Base
|
||||
title={title}
|
||||
meta_title={meta_title}
|
||||
|
||||
@@ -5,14 +5,14 @@ import config from "@/config/config.json";
|
||||
import Base from "@/layouts/Base.astro";
|
||||
import { getListPage, getSinglePage } from "@/lib/contentParser.astro";
|
||||
import { getAllTaxonomy, getTaxonomy } from "@/lib/taxonomyParser.astro";
|
||||
import { supportedLang } from "@/lib/utils/i18nUtils";
|
||||
import { sortByDate } from "@/lib/utils/sortFunctions";
|
||||
import PageHeader from "@/partials/PageHeader.astro";
|
||||
import PostSidebar from "@/partials/PostSidebar.astro";
|
||||
import type { ContentEntryMap } from "astro:content";
|
||||
|
||||
export function getStaticPaths() {
|
||||
const { supported } = config.language;
|
||||
const paths = supported.map((lang) => ({
|
||||
const paths = supportedLang.map((lang) => ({
|
||||
params: { lang: lang || undefined },
|
||||
}));
|
||||
return paths;
|
||||
|
||||
@@ -4,26 +4,29 @@ import Pagination from "@/components/Pagination.astro";
|
||||
import config from "@/config/config.json";
|
||||
import Base from "@/layouts/Base.astro";
|
||||
import { getAllTaxonomy, getTaxonomy } from "@/lib/taxonomyParser.astro";
|
||||
import { supportedLang } from "@/lib/utils/i18nUtils";
|
||||
import { sortByDate } from "@/lib/utils/sortFunctions";
|
||||
import PageHeader from "@/partials/PageHeader.astro";
|
||||
import PostSidebar from "@/partials/PostSidebar.astro";
|
||||
import type { ContentEntryMap } from "astro:content";
|
||||
import { getCollection } from "astro:content";
|
||||
|
||||
const BLOG_FOLDER = "blog";
|
||||
|
||||
const { slug, lang } = Astro.params;
|
||||
|
||||
const postIndex = await getCollection(
|
||||
lang as keyof ContentEntryMap,
|
||||
({ id }) => {
|
||||
({ id }: any) => {
|
||||
return id.startsWith(BLOG_FOLDER);
|
||||
}
|
||||
);
|
||||
|
||||
const posts = await getCollection(lang as keyof ContentEntryMap, ({ id }) => {
|
||||
return id.startsWith(BLOG_FOLDER) && !id.endsWith("-index.md");
|
||||
});
|
||||
const posts = await getCollection(
|
||||
lang as keyof ContentEntryMap,
|
||||
({ id }: any) => {
|
||||
return id.startsWith(BLOG_FOLDER) && !id.endsWith("-index.md");
|
||||
}
|
||||
);
|
||||
|
||||
const langCollection: keyof ContentEntryMap = lang as keyof ContentEntryMap;
|
||||
const allCategories = await getAllTaxonomy(langCollection, "categories");
|
||||
@@ -37,14 +40,13 @@ const indexOfFirstPost = indexOfLastPost - config.settings.pagination;
|
||||
const currentPosts = sortedPosts.slice(indexOfFirstPost, indexOfLastPost);
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const { supported } = config.language;
|
||||
const BLOG_FOLDER = "blog";
|
||||
|
||||
const paths = await Promise.all(
|
||||
supported.map(async (lang) => {
|
||||
supportedLang.map(async (lang) => {
|
||||
const posts = await getCollection(
|
||||
lang as keyof ContentEntryMap,
|
||||
({ id }) => {
|
||||
({ id }: any) => {
|
||||
return id.startsWith(BLOG_FOLDER) && !id.endsWith("-index.md");
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
---
|
||||
import BlogCard from "@/components/BlogCard.astro";
|
||||
import config from "@/config/config.json";
|
||||
import Base from "@/layouts/Base.astro";
|
||||
import { getSinglePage } from "@/lib/contentParser.astro";
|
||||
import { getTaxonomy } from "@/lib/taxonomyParser.astro";
|
||||
import { supportedLang } from "@/lib/utils/i18nUtils";
|
||||
import { sortByDate } from "@/lib/utils/sortFunctions";
|
||||
import taxonomyFilter from "@/lib/utils/taxonomyFilter";
|
||||
import PageHeader from "@/partials/PageHeader.astro";
|
||||
|
||||
// get all static paths for categories
|
||||
export async function getStaticPaths() {
|
||||
const { supported } = config.language;
|
||||
|
||||
const paths = await Promise.all(
|
||||
supported.map(async (lang) => {
|
||||
supportedLang.map(async (lang) => {
|
||||
const categories = await getTaxonomy(lang, "categories");
|
||||
|
||||
return categories.map((category) => ({
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
---
|
||||
import Base from "@/layouts/Base.astro";
|
||||
import { getAllTaxonomy, getTaxonomy } from "@/lib/taxonomyParser.astro";
|
||||
import { supportedLang } from "@/lib/utils/i18nUtils";
|
||||
import { humanize } from "@/lib/utils/textConverter";
|
||||
import PageHeader from "@/partials/PageHeader.astro";
|
||||
import config from "@/config/config.json";
|
||||
import type { ContentEntryMap } from "astro:content";
|
||||
|
||||
export function getStaticPaths() {
|
||||
const {supported } = config.language;
|
||||
const paths = supported.map((lang) => ({ params: { lang: lang || undefined } }));
|
||||
const paths = supportedLang.map((lang) => ({
|
||||
params: { lang: lang || undefined },
|
||||
}));
|
||||
return paths;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,14 @@
|
||||
import config from "@/config/config.json";
|
||||
import Base from "@/layouts/Base.astro";
|
||||
import { getListPage } from "@/lib/contentParser.astro";
|
||||
import { useTranslations } from "@/lib/utils/i18nUtils";
|
||||
import { getTranslations, supportedLang } from "@/lib/utils/i18nUtils";
|
||||
import PageHeader from "@/partials/PageHeader.astro";
|
||||
import { type ContentEntryMap } from "astro:content";
|
||||
|
||||
export function getStaticPaths() {
|
||||
const {supported} = config.language;
|
||||
const paths = supported.map((lang) => ({ params: { lang: lang || undefined } }));
|
||||
const paths = supportedLang.map((lang) => ({
|
||||
params: { lang: lang || undefined },
|
||||
}));
|
||||
return paths;
|
||||
}
|
||||
|
||||
@@ -18,7 +19,13 @@ 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;
|
||||
|
||||
const t = useTranslations(lang as any);
|
||||
const {
|
||||
working_mail,
|
||||
full_name,
|
||||
anything_else,
|
||||
contact_message_placeholder,
|
||||
submit,
|
||||
} = await getTranslations(lang as keyof ContentEntryMap);
|
||||
---
|
||||
|
||||
<Base
|
||||
@@ -35,7 +42,7 @@ const t = useTranslations(lang as any);
|
||||
<form action={contact_form_action} method="POST">
|
||||
<div class="mb-6">
|
||||
<label for="name" class="form-label">
|
||||
{t("full_name")}
|
||||
{full_name}
|
||||
<span class="text-red-500">*</span>
|
||||
</label>
|
||||
<input
|
||||
@@ -48,7 +55,8 @@ const t = useTranslations(lang as any);
|
||||
</div>
|
||||
<div class="mb-6">
|
||||
<label for="email" class="form-label">
|
||||
{t("working_mail")} <span class="text-red-500">*</span>
|
||||
{working_mail}
|
||||
<span class="text-red-500">*</span>
|
||||
</label>
|
||||
<input
|
||||
id="email"
|
||||
@@ -60,16 +68,17 @@ const t = useTranslations(lang as any);
|
||||
</div>
|
||||
<div class="mb-6">
|
||||
<label for="message" class="form-label">
|
||||
{t("anything_else")} <span class="text-red-500">*</span>
|
||||
{anything_else}
|
||||
<span class="text-red-500">*</span>
|
||||
</label>
|
||||
<textarea
|
||||
id="message"
|
||||
name="message"
|
||||
class="form-input"
|
||||
placeholder={t("contact_message_placeholder")}
|
||||
placeholder={contact_message_placeholder}
|
||||
rows="8"></textarea>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">{t("submit")}</button>
|
||||
<button type="submit" class="btn btn-primary">{submit}</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -11,6 +11,7 @@ import type { ContentEntryMap } from "astro:content";
|
||||
import { getCollection } from "astro:content";
|
||||
import { FaCheck } from "react-icons/fa";
|
||||
const { defaultLang } = config.language;
|
||||
import { supportedLang } from "@/lib/utils/i18nUtils";
|
||||
|
||||
interface Homepage {
|
||||
banner: {
|
||||
@@ -23,29 +24,25 @@ interface Homepage {
|
||||
}
|
||||
|
||||
export function getStaticPaths() {
|
||||
const { supported } = config.language;
|
||||
const paths = supported.map((lang) => ({
|
||||
const paths = supportedLang.map((lang) => ({
|
||||
params: { lang: lang || undefined },
|
||||
}));
|
||||
return paths;
|
||||
}
|
||||
|
||||
const { lang } = Astro.params;
|
||||
const homepage = await getListPage("homepage", lang as keyof ContentEntryMap);
|
||||
|
||||
// const testimonial = await getEntry("sections", "testimonial");
|
||||
// const call_to_action = await getEntry("sections", "call-to-action");
|
||||
const homepage = await getListPage("homepage", lang);
|
||||
const { banner, features }: Homepage = homepage[0].data;
|
||||
|
||||
const testimonial = await getCollection(
|
||||
(lang as keyof ContentEntryMap) || defaultLang,
|
||||
({ id }) => {
|
||||
({ id }: any) => {
|
||||
return id.startsWith("sections/testimonial") && !id.endsWith("-index.md");
|
||||
}
|
||||
);
|
||||
const call_to_action = await getCollection(
|
||||
(lang as keyof ContentEntryMap) || defaultLang,
|
||||
({ id }) => {
|
||||
({ id }: any) => {
|
||||
return (
|
||||
id.startsWith("sections/call-to-action") && !id.endsWith("-index.md")
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user