From f7bc32a62979d80876ca3a87fc112263a2bffe99 Mon Sep 17 00:00:00 2001
From: Somrat <58769763+tfsomrat@users.noreply.github.com>
Date: Mon, 18 Nov 2024 09:55:18 +0600
Subject: [PATCH] remove multilingual and create a new multilingual branch
---
astro.config.mjs | 16 +-
package.json | 6 +-
scripts/jsonGenerator.js | 91 +++----
scripts/removeMultilang.js | 72 -----
src/config/config.json | 5 +-
src/config/language.json | 14 -
src/config/menu.en.json | 24 --
src/config/menu.fr.json | 24 --
src/config/menu.json | 57 ++++
src/content/about/{english => }/-index.md | 0
src/content/about/french/-index.md | 9 -
src/content/authors/{english => }/-index.md | 0
src/content/authors/french/-index.md | 5 -
src/content/authors/french/john-doe.md | 20 --
src/content/authors/french/sam-wilson.md | 20 --
src/content/authors/french/william-jacob.md | 20 --
src/content/authors/{english => }/john-doe.md | 0
.../authors/{english => }/sam-wilson.md | 0
.../authors/{english => }/william-jacob.md | 0
src/content/blog/{english => }/-index.md | 0
src/content/blog/french/-index.md | 5 -
src/content/blog/french/post-1.md | 23 --
src/content/blog/french/post-2.md | 23 --
src/content/blog/french/post-3.md | 23 --
src/content/blog/french/post-4.md | 23 --
src/content/blog/{english => }/post-1.md | 0
src/content/blog/{english => }/post-2.md | 0
src/content/blog/{english => }/post-3.md | 0
src/content/blog/{english => }/post-4.md | 0
src/content/config.ts | 89 +-----
src/content/contact/{english => }/-index.md | 0
src/content/contact/french/-index.md | 6 -
src/content/homepage/{english => }/-index.md | 0
src/content/homepage/french/-index.md | 53 ----
src/content/pages/{english => }/elements.mdx | 0
src/content/pages/french/elements.mdx | 255 ------------------
src/content/pages/french/privacy-policy.md | 30 ---
.../pages/{english => }/privacy-policy.md | 0
.../sections/{english => }/call-to-action.md | 0
src/content/sections/french/call-to-action.md | 10 -
src/content/sections/french/testimonial.md | 27 --
.../sections/{english => }/testimonial.md | 0
src/i18n/en.json | 16 --
src/i18n/fr.json | 16 --
src/layouts/Base.astro | 26 +-
src/layouts/PostSingle.astro | 22 +-
src/layouts/components/AuthorCard.astro | 4 +-
src/layouts/components/BlogCard.astro | 31 +--
src/layouts/components/Breadcrumbs.astro | 19 +-
src/layouts/components/Logo.astro | 11 +-
src/layouts/components/Pagination.astro | 25 +-
src/layouts/components/ThemeSwitcher.astro | 8 +-
src/layouts/helpers/LanguageSwitcher.tsx | 65 -----
src/layouts/helpers/SearchModal.tsx | 18 +-
src/layouts/helpers/SearchResult.tsx | 16 +-
src/layouts/partials/Footer.astro | 18 +-
src/layouts/partials/Header.astro | 73 +++--
src/layouts/partials/PostSidebar.astro | 6 +-
src/layouts/partials/Testimonial.astro | 2 +-
src/lib/contentParser.astro | 124 +--------
src/lib/taxonomyParser.astro | 55 +---
src/lib/utils/languageParser.ts | 110 --------
src/pages/404.astro | 36 +--
src/pages/[...lang]/authors/index.astro | 44 ---
src/pages/[...lang]/blog/[single].astro | 43 ---
.../[...lang]/categories/[category].astro | 78 ------
src/pages/[...lang]/tags/[tag].astro | 75 ------
src/pages/{[...lang] => }/[regular].astro | 28 +-
src/pages/{[...lang] => }/about.astro | 19 +-
.../{[...lang] => }/authors/[single].astro | 36 +--
src/pages/authors/index.astro | 29 ++
src/pages/blog/[single].astro | 30 +++
src/pages/{[...lang] => }/blog/index.astro | 36 +--
.../{[...lang] => }/blog/page/[slug].astro | 78 ++----
src/pages/categories/[category].astro | 46 ++++
.../{[...lang] => }/categories/index.astro | 23 +-
src/pages/{[...lang] => }/contact.astro | 38 +--
src/pages/{[...lang] => }/index.astro | 44 ++-
src/pages/tags/[tag].astro | 45 ++++
src/pages/{[...lang] => }/tags/index.astro | 23 +-
src/styles/main.scss | 13 +-
src/types/index.d.ts | 2 -
82 files changed, 453 insertions(+), 1928 deletions(-)
delete mode 100644 scripts/removeMultilang.js
delete mode 100644 src/config/language.json
delete mode 100644 src/config/menu.en.json
delete mode 100644 src/config/menu.fr.json
create mode 100755 src/config/menu.json
rename src/content/about/{english => }/-index.md (100%)
delete mode 100644 src/content/about/french/-index.md
rename src/content/authors/{english => }/-index.md (100%)
delete mode 100644 src/content/authors/french/-index.md
delete mode 100644 src/content/authors/french/john-doe.md
delete mode 100644 src/content/authors/french/sam-wilson.md
delete mode 100644 src/content/authors/french/william-jacob.md
rename src/content/authors/{english => }/john-doe.md (100%)
rename src/content/authors/{english => }/sam-wilson.md (100%)
rename src/content/authors/{english => }/william-jacob.md (100%)
rename src/content/blog/{english => }/-index.md (100%)
delete mode 100755 src/content/blog/french/-index.md
delete mode 100755 src/content/blog/french/post-1.md
delete mode 100755 src/content/blog/french/post-2.md
delete mode 100755 src/content/blog/french/post-3.md
delete mode 100755 src/content/blog/french/post-4.md
rename src/content/blog/{english => }/post-1.md (100%)
rename src/content/blog/{english => }/post-2.md (100%)
rename src/content/blog/{english => }/post-3.md (100%)
rename src/content/blog/{english => }/post-4.md (100%)
rename src/content/contact/{english => }/-index.md (100%)
delete mode 100644 src/content/contact/french/-index.md
rename src/content/homepage/{english => }/-index.md (100%)
delete mode 100755 src/content/homepage/french/-index.md
rename src/content/pages/{english => }/elements.mdx (100%)
delete mode 100755 src/content/pages/french/elements.mdx
delete mode 100644 src/content/pages/french/privacy-policy.md
rename src/content/pages/{english => }/privacy-policy.md (100%)
rename src/content/sections/{english => }/call-to-action.md (100%)
delete mode 100644 src/content/sections/french/call-to-action.md
delete mode 100644 src/content/sections/french/testimonial.md
rename src/content/sections/{english => }/testimonial.md (100%)
delete mode 100644 src/i18n/en.json
delete mode 100644 src/i18n/fr.json
delete mode 100644 src/layouts/helpers/LanguageSwitcher.tsx
delete mode 100644 src/lib/utils/languageParser.ts
delete mode 100755 src/pages/[...lang]/authors/index.astro
delete mode 100755 src/pages/[...lang]/blog/[single].astro
delete mode 100755 src/pages/[...lang]/categories/[category].astro
delete mode 100644 src/pages/[...lang]/tags/[tag].astro
rename src/pages/{[...lang] => }/[regular].astro (58%)
rename src/pages/{[...lang] => }/about.astro (62%)
rename src/pages/{[...lang] => }/authors/[single].astro (70%)
create mode 100755 src/pages/authors/index.astro
create mode 100755 src/pages/blog/[single].astro
rename src/pages/{[...lang] => }/blog/index.astro (58%)
rename src/pages/{[...lang] => }/blog/page/[slug].astro (52%)
create mode 100755 src/pages/categories/[category].astro
rename src/pages/{[...lang] => }/categories/index.astro (59%)
rename src/pages/{[...lang] => }/contact.astro (59%)
rename src/pages/{[...lang] => }/index.astro (75%)
create mode 100755 src/pages/tags/[tag].astro
rename src/pages/{[...lang] => }/tags/index.astro (59%)
mode change 100644 => 100755
diff --git a/astro.config.mjs b/astro.config.mjs
index 0409e02..bae7e44 100755
--- a/astro.config.mjs
+++ b/astro.config.mjs
@@ -7,26 +7,12 @@ import { defineConfig, squooshImageService } from "astro/config";
import remarkCollapse from "remark-collapse";
import remarkToc from "remark-toc";
import config from "./src/config/config.json";
-import languagesJSON from "./src/config/language.json";
-const { default_language } = config.settings;
-
-const supportedLang = [...languagesJSON.map((lang) => lang.languageCode)];
-const disabledLanguages = config.settings.disable_languages;
-
-// Filter out disabled languages from supportedLang
-const filteredSupportedLang = supportedLang.filter(
- (lang) => !disabledLanguages.includes(lang),
-);
// https://astro.build/config
export default defineConfig({
site: config.site.base_url ? config.site.base_url : "http://examplesite.com",
base: config.site.base_path ? config.site.base_path : "/",
- trailingSlash: config.site.trailing_slash ? "always" : "ignore",
- i18n: {
- locales: filteredSupportedLang,
- defaultLocale: default_language,
- },
+ trailingSlash: config.site.trailing_slash ? "always" : "never",
image: {
service: squooshImageService(),
},
diff --git a/package.json b/package.json
index b2a7539..795bbbc 100755
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "astroplate",
- "version": "4.0.1",
+ "version": "4.1.0",
"description": "Astro and Tailwindcss boilerplate",
"author": "zeon.studio",
"license": "MIT",
@@ -10,10 +10,8 @@
"build": "yarn generate-json && astro build",
"preview": "astro preview",
"format": "prettier -w ./src",
- "check": "astro check",
"generate-json": "node scripts/jsonGenerator.js",
- "remove-darkmode": "node scripts/removeDarkmode.js && yarn format",
- "remove-multilang": "node scripts/removeMultilang.js && yarn format"
+ "remove-darkmode": "node scripts/removeDarkmode.js && yarn format"
},
"dependencies": {
"@astrojs/check": "^0.9.3",
diff --git a/scripts/jsonGenerator.js b/scripts/jsonGenerator.js
index 5881da2..8aee1ac 100644
--- a/scripts/jsonGenerator.js
+++ b/scripts/jsonGenerator.js
@@ -1,66 +1,49 @@
const fs = require("fs");
const path = require("path");
const matter = require("gray-matter");
-const languages = require("../src/config/language.json");
+const CONTENT_DEPTH = 2;
const JSON_FOLDER = "./.json";
-const CONTENT_ROOT = "src/content";
-const CONTENT_DEPTH = 3;
-const BLOG_FOLDER = "blog";
+const BLOG_FOLDER = "src/content/blog";
// get data from markdown
-const getData = (folder, groupDepth, langIndex = 0) => {
- const getPaths = languages
- .map((lang, index) => {
- const langFolder = lang.contentDir ? lang.contentDir : lang.languageCode;
- const dir = path.join(CONTENT_ROOT, folder, langFolder);
- return fs
- .readdirSync(dir)
- .filter(
- (filename) =>
- !filename.startsWith("-") &&
- (filename.endsWith(".md") || filename.endsWith(".mdx")),
- )
- .flatMap((filename) => {
- const filepath = path.join(dir, filename);
- const stats = fs.statSync(filepath);
- const isFolder = stats.isDirectory();
+const getData = (folder, groupDepth) => {
+ const getPath = fs.readdirSync(folder);
+ const removeIndex = getPath.filter((item) => !item.startsWith("-"));
- if (isFolder) {
- return getData(filepath, groupDepth, index);
- } else {
- const file = fs.readFileSync(filepath, "utf-8");
- const { data, content } = matter(file);
- const pathParts = filepath.split(path.sep);
+ const getPaths = removeIndex.flatMap((filename) => {
+ const filepath = path.join(folder, filename);
+ const stats = fs.statSync(filepath);
+ const isFolder = stats.isDirectory();
- let slug;
- if (data.slug) {
- const slugParts = data.slug.split("/");
- slugParts[0] = BLOG_FOLDER;
- slug = slugParts.join("/");
- } else {
- slug = pathParts
- .slice(CONTENT_DEPTH)
- .join("/")
- .replace(/\.[^/.]+$/, "");
- slug = `${BLOG_FOLDER}/${slug.split("/").slice(1).join("/")}`;
- }
- data.slug = slug;
- const group = "blog";
+ if (isFolder) {
+ return getData(filepath, groupDepth);
+ } else if (filename.endsWith(".md") || filename.endsWith(".mdx")) {
+ const file = fs.readFileSync(filepath, "utf-8");
+ const { data, content } = matter(file);
+ const pathParts = filepath.split(path.sep);
+ const slug =
+ data.slug ||
+ pathParts
+ .slice(CONTENT_DEPTH)
+ .join("/")
+ .replace(/\.[^/.]+$/, "");
+ const group = pathParts[groupDepth];
- return {
- lang: languages[index].languageCode, // Set the correct language code dynamically
- group: group,
- slug: data.slug,
- frontmatter: data,
- content: content,
- };
- }
- });
- })
- .flat();
+ return {
+ group: group,
+ slug: slug,
+ frontmatter: data,
+ content: content,
+ };
+ } else {
+ return [];
+ }
+ });
- const publishedPages = getPaths.filter((page) => !page.frontmatter?.draft);
+ const publishedPages = getPaths.filter(
+ (page) => !page.frontmatter?.draft && page,
+ );
return publishedPages;
};
@@ -73,10 +56,10 @@ try {
// create json files
fs.writeFileSync(
`${JSON_FOLDER}/posts.json`,
- JSON.stringify(getData(BLOG_FOLDER, 3)),
+ JSON.stringify(getData(BLOG_FOLDER, 2)),
);
- // merge json files for search
+ // merger json files for search
const posts = require(`../${JSON_FOLDER}/posts.json`);
const search = [...posts];
fs.writeFileSync(`${JSON_FOLDER}/search.json`, JSON.stringify(search));
diff --git a/scripts/removeMultilang.js b/scripts/removeMultilang.js
deleted file mode 100644
index d885069..0000000
--- a/scripts/removeMultilang.js
+++ /dev/null
@@ -1,72 +0,0 @@
-const fs = require("fs");
-const path = require("path");
-const languages = require("../src/config/language.json");
-
-// Filter out the English language
-const englishLang = languages.filter((item) => item.languageCode === "en");
-const filterLangs = languages.filter((item) => item.languageCode !== "en");
-const contentDir = "src/content";
-const configDir = "src/config";
-const i18nDir = "src/i18n";
-
-// Update language.json to only include the English language
-fs.writeFileSync(
- path.join(configDir, "language.json"),
- JSON.stringify(englishLang, null, 2),
-);
-
-// Remove content directories for languages other than English
-filterLangs.forEach((lang) => {
- const langContentDir = path.join(contentDir, lang.contentDir);
- fs.rm(langContentDir, { recursive: true, force: true }, (err) => {
- if (err) {
- console.error(`Error deleting folder ${langContentDir}:`, err);
- return;
- }
- console.log(`Folder ${langContentDir} deleted successfully`);
- });
-});
-
-// Remove other menu.{lang}.json files except menu.en.json
-fs.readdir(configDir, (err, files) => {
- if (err) {
- console.error("Error reading config directory:", err);
- return;
- }
-
- files.forEach((file) => {
- if (file.startsWith("menu.") && file !== "menu.en.json") {
- const filePath = path.join(configDir, file);
- fs.unlink(filePath, (err) => {
- if (err) {
- console.error(`Error deleting file ${filePath}:`, err);
- return;
- }
- console.log(`File ${filePath} deleted successfully`);
- });
- }
- });
-});
-
-// Remove other language files from i18n folder except en.json
-fs.readdir(i18nDir, (err, files) => {
- if (err) {
- console.error("Error reading i18n directory:", err);
- return;
- }
-
- files.forEach((file) => {
- if (file !== "en.json") {
- const filePath = path.join(i18nDir, file);
- fs.unlink(filePath, (err) => {
- if (err) {
- console.error(`Error deleting file ${filePath}:`, err);
- return;
- }
- console.log(`File ${filePath} deleted successfully`);
- });
- }
- });
-});
-
-console.log("Cleanup completed.");
diff --git a/src/config/config.json b/src/config/config.json
index 3b3d910..683fe50 100755
--- a/src/config/config.json
+++ b/src/config/config.json
@@ -19,10 +19,7 @@
"default_theme": "system",
"pagination": 2,
"summary_length": 200,
- "blog_folder": "blog",
- "default_language": "en",
- "disable_languages": [],
- "default_language_in_subdir": false
+ "blog_folder": "blog"
},
"params": {
diff --git a/src/config/language.json b/src/config/language.json
deleted file mode 100644
index 706b137..0000000
--- a/src/config/language.json
+++ /dev/null
@@ -1,14 +0,0 @@
-[
- {
- "languageName": "En",
- "languageCode": "en",
- "contentDir": "english",
- "weight": 1
- },
- {
- "languageName": "Fr",
- "languageCode": "fr",
- "contentDir": "french",
- "weight": 2
- }
-]
diff --git a/src/config/menu.en.json b/src/config/menu.en.json
deleted file mode 100644
index 9f52c3a..0000000
--- a/src/config/menu.en.json
+++ /dev/null
@@ -1,24 +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/config/menu.fr.json b/src/config/menu.fr.json
deleted file mode 100644
index 495c883..0000000
--- a/src/config/menu.fr.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "main": [
- { "name": "Accueil", "url": "/" },
- { "name": "À propos", "url": "/about" },
- { "name": "Éléments", "url": "/elements" },
- {
- "name": "Pages",
- "url": "",
- "hasChildren": true,
- "children": [
- { "name": "Contact", "url": "/contact" },
- { "name": "Blog", "url": "/blog" },
- { "name": "Auteurs", "url": "/authors" },
- { "name": "Catégories", "url": "/categories" },
- { "name": "Étiquettes", "url": "/tags" },
- { "name": "Page 404", "url": "/404" }
- ]
- }
- ],
- "footer": [
- { "name": "Éléments", "url": "/elements" },
- { "name": "Politique de confidentialité", "url": "/privacy-policy" }
- ]
-}
diff --git a/src/config/menu.json b/src/config/menu.json
new file mode 100755
index 0000000..3502218
--- /dev/null
+++ b/src/config/menu.json
@@ -0,0 +1,57 @@
+{
+ "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/content/about/english/-index.md b/src/content/about/-index.md
similarity index 100%
rename from src/content/about/english/-index.md
rename to src/content/about/-index.md
diff --git a/src/content/about/french/-index.md b/src/content/about/french/-index.md
deleted file mode 100644
index 041c6ad..0000000
--- a/src/content/about/french/-index.md
+++ /dev/null
@@ -1,9 +0,0 @@
----
-title: "Hé, je suis John Doe !"
-meta_title: "About"
-description: "this is meta description"
-image: "/images/avatar.png"
-draft: false
----
-
-L'entreprise elle-même est une entreprise très prospère. Ils ne connaissent pas les bienfaits du corps, ou sauf qu'ils le recevront à d'autres moments, le tout, les temps de travail, qu'il déteste à partir de ce moment mais. Il fuit les plaisirs perçus pour être supposés n'être rien, tout ou, et la douleur est ce qui est la plus grande option, car cela lui est facile, et avec ce que cela s'ensuit, ils lui procurent de la douleur et ainsi de suite ! Car ledit expédient de la vérité repousse le plaisir et empêche la douleur, ils fournissent comme si
diff --git a/src/content/authors/english/-index.md b/src/content/authors/-index.md
similarity index 100%
rename from src/content/authors/english/-index.md
rename to src/content/authors/-index.md
diff --git a/src/content/authors/french/-index.md b/src/content/authors/french/-index.md
deleted file mode 100644
index 517a9bf..0000000
--- a/src/content/authors/french/-index.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: "Auteurs"
-meta_title: ""
-description: "this is meta description"
----
diff --git a/src/content/authors/french/john-doe.md b/src/content/authors/french/john-doe.md
deleted file mode 100644
index 857f439..0000000
--- a/src/content/authors/french/john-doe.md
+++ /dev/null
@@ -1,20 +0,0 @@
----
-title: John Doe
-email: johndoe@email.com
-image: "/images/avatar.png"
-description: this is meta description
-social:
- - name: github
- icon: FaGithub
- link: https://github.com
-
- - name: twitter
- icon: FaTwitter
- link: https://twitter.com
-
- - name: linkedin
- icon: FaLinkedin
- link: https://linkedin.com
----
-
-lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostr navigation et dolore magna aliqua.
diff --git a/src/content/authors/french/sam-wilson.md b/src/content/authors/french/sam-wilson.md
deleted file mode 100644
index d3ab0e5..0000000
--- a/src/content/authors/french/sam-wilson.md
+++ /dev/null
@@ -1,20 +0,0 @@
----
-title: Sam Wilson
-email: samwilson@email.com
-image: "/images/avatar.png"
-description: this is meta description
-social:
- - name: github
- icon: FaGithub
- link: https://github.com
-
- - name: twitter
- icon: FaTwitter
- link: https://twitter.com
-
- - name: linkedin
- icon: FaLinkedin
- link: https://linkedin.com
----
-
-lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostr navigation et dolore magna aliqua.
diff --git a/src/content/authors/french/william-jacob.md b/src/content/authors/french/william-jacob.md
deleted file mode 100644
index 193589a..0000000
--- a/src/content/authors/french/william-jacob.md
+++ /dev/null
@@ -1,20 +0,0 @@
----
-title: Guillaume Jacob
-email: williamjacob@email.com
-image: "/images/avatar.png"
-description: this is meta description
-social:
- - name: github
- icon: FaGithub
- link: https://github.com
-
- - name: twitter
- icon: FaTwitter
- link: https://twitter.com
-
- - name: linkedin
- icon: FaLinkedin
- link: https://linkedin.com
----
-
-lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostr navigation et dolore magna aliqua.
diff --git a/src/content/authors/english/john-doe.md b/src/content/authors/john-doe.md
similarity index 100%
rename from src/content/authors/english/john-doe.md
rename to src/content/authors/john-doe.md
diff --git a/src/content/authors/english/sam-wilson.md b/src/content/authors/sam-wilson.md
similarity index 100%
rename from src/content/authors/english/sam-wilson.md
rename to src/content/authors/sam-wilson.md
diff --git a/src/content/authors/english/william-jacob.md b/src/content/authors/william-jacob.md
similarity index 100%
rename from src/content/authors/english/william-jacob.md
rename to src/content/authors/william-jacob.md
diff --git a/src/content/blog/english/-index.md b/src/content/blog/-index.md
similarity index 100%
rename from src/content/blog/english/-index.md
rename to src/content/blog/-index.md
diff --git a/src/content/blog/french/-index.md b/src/content/blog/french/-index.md
deleted file mode 100755
index eac3331..0000000
--- a/src/content/blog/french/-index.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: "Articles de blog"
-meta_title: ""
-description: "Ceci est une méta-description"
----
diff --git a/src/content/blog/french/post-1.md b/src/content/blog/french/post-1.md
deleted file mode 100755
index 8d1a370..0000000
--- a/src/content/blog/french/post-1.md
+++ /dev/null
@@ -1,23 +0,0 @@
----
-title: "Comment créer une application avec des technologies modernes"
-meta_title: ""
-description: "Ceci est une méta-description"
-date: 2022-04-04T05:00:00Z
-image: "/images/image-placeholder.png"
-categories: ["french","Application", "Data"]
-author: "John Doe"
-tags: ["nextjs", "tailwind", "react"]
-draft: false
----
-
-Personne ne veut même sortir un maquillage de l'urne des soins empoisonnés. C'était un week-end. Je suis un footballeur complet. Pour boire, le lac occupe le plus grand porche. Chacune des cibles de la vie ne flatte pas Euismod.
-
-L'entreprise elle-même est une entreprise très prospère. Personne ne prend même la peine de l'ouvrir. Alors je vais ouvrir la naissance pour choisir ? Être rejeté par certaines personnes est un choix commode du présent pour ressentir une douleur comme la sienne !
-
-## Design Créatif
-
-Car en guise de maquillage, l'urne du poison C'était un week-end. Je suis un footballeur complet. Pour boire, le lac occupe le plus grand porche. Chacune des cibles de la vie ne flatte pas Euismod.
-
-> Le client lui-même doit pouvoir poursuivre l'adipisicing. Personne ne prend même la peine de l'ouvrir. Alors je vais ouvrir la naissance pour choisir ? Être rejeté par certaines personnes est un choix commode du présent pour ressentir une douleur comme la sienne !
-
-L'entreprise elle-même est une entreprise très prospère. Personne ne prend même la peine de l'ouvrir. Alors je vais ouvrir la naissance pour choisir ? Être rejeté par certaines personnes est un choix commode du présent pour ressentir une douleur comme la sienne !
diff --git a/src/content/blog/french/post-2.md b/src/content/blog/french/post-2.md
deleted file mode 100755
index 38a17df..0000000
--- a/src/content/blog/french/post-2.md
+++ /dev/null
@@ -1,23 +0,0 @@
----
-title: "Comment créer une application avec des technologies modernes"
-meta_title: ""
-description: "Ceci est une méta-description"
-date: 2022-04-04T05:00:00Z
-image: "/images/image-placeholder.png"
-categories: ["Technology", "Data"]
-author: "Sam Wilson"
-tags: ["technology", "tailwind"]
-draft: false
----
-
-Personne ne veut même sortir un maquillage de l'urne des soins empoisonnés. C'était un week-end. Je suis un footballeur complet. Pour boire, le lac occupe le plus grand porche. Chacune des cibles de la vie ne flatte pas Euismod.
-
-L'entreprise elle-même est une entreprise très prospère. Personne ne prend même la peine de l'ouvrir. Alors je vais ouvrir la naissance pour choisir ? Être rejeté par certaines personnes est un choix commode du présent pour ressentir une douleur comme la sienne !
-
-## Design Créatif
-
-Car en guise de maquillage, l'urne du poison C'était un week-end. Je suis un footballeur complet. Pour boire, le lac occupe le plus grand porche. Chacune des cibles de la vie ne flatte pas Euismod.
-
-> Le client lui-même doit pouvoir poursuivre l'adipisicing. Personne ne prend même la peine de l'ouvrir. Alors je vais ouvrir la naissance pour choisir ? Être rejeté par certaines personnes est un choix commode du présent pour ressentir une douleur comme la sienne !
-
-L'entreprise elle-même est une entreprise très prospère. Personne ne prend même la peine de l'ouvrir. Alors je vais ouvrir la naissance pour choisir ? Être rejeté par certaines personnes est un choix commode du présent pour ressentir une douleur comme la sienne !
diff --git a/src/content/blog/french/post-3.md b/src/content/blog/french/post-3.md
deleted file mode 100755
index 7c1fb81..0000000
--- a/src/content/blog/french/post-3.md
+++ /dev/null
@@ -1,23 +0,0 @@
----
-title: "Comment créer une application avec des technologies modernes"
-meta_title: ""
-description: "Ceci est une méta-description"
-date: 2022-04-04T05:00:00Z
-image: "/images/image-placeholder.png"
-categories: ["Software"]
-author: "John Doe"
-tags: ["software", "tailwind"]
-draft: false
----
-
-Personne ne veut même sortir un maquillage de l'urne des soins empoisonnés. C'était un week-end. Je suis un footballeur complet. Pour boire, le lac occupe le plus grand porche. Chacune des cibles de la vie ne flatte pas Euismod.
-
-L'entreprise elle-même est une entreprise très prospère. Personne ne prend même la peine de l'ouvrir. Alors je vais ouvrir la naissance pour choisir ? Être rejeté par certaines personnes est un choix commode du présent pour ressentir une douleur comme la sienne !
-
-## Design Créatif
-
-Car en guise de maquillage, l'urne du poison C'était un week-end. Je suis un footballeur complet. Pour boire, le lac occupe le plus grand porche. Chacune des cibles de la vie ne flatte pas Euismod.
-
-> Le client lui-même doit pouvoir poursuivre l'adipisicing. Personne ne prend même la peine de l'ouvrir. Alors je vais ouvrir la naissance pour choisir ? Être rejeté par certaines personnes est un choix commode du présent pour ressentir une douleur comme la sienne !
-
-L'entreprise elle-même est une entreprise très prospère. Personne ne prend même la peine de l'ouvrir. Alors je vais ouvrir la naissance pour choisir ? Être rejeté par certaines personnes est un choix commode du présent pour ressentir une douleur comme la sienne !
diff --git a/src/content/blog/french/post-4.md b/src/content/blog/french/post-4.md
deleted file mode 100755
index d489e36..0000000
--- a/src/content/blog/french/post-4.md
+++ /dev/null
@@ -1,23 +0,0 @@
----
-title: "Comment créer une application avec des technologies modernes"
-meta_title: ""
-description: "Ceci est une méta-description"
-date: 2022-04-04T05:00:00Z
-image: "/images/image-placeholder.png"
-categories: ["Architecture"]
-author: "John Doe"
-tags: ["silicon", "technology"]
-draft: false
----
-
-Personne ne veut même sortir un maquillage de l'urne des soins empoisonnés. C'était un week-end. Je suis un footballeur complet. Pour boire, le lac occupe le plus grand porche. Chacune des cibles de la vie ne flatte pas Euismod.
-
-L'entreprise elle-même est une entreprise très prospère. Personne ne prend même la peine de l'ouvrir. Alors je vais ouvrir la naissance pour choisir ? Être rejeté par certaines personnes est un choix commode du présent pour ressentir une douleur comme la sienne !
-
-## Design Créatif
-
-Car en guise de maquillage, l'urne du poison C'était un week-end. Je suis un footballeur complet. Pour boire, le lac occupe le plus grand porche. Chacune des cibles de la vie ne flatte pas Euismod.
-
-> Le client lui-même doit pouvoir poursuivre l'adipisicing. Personne ne prend même la peine de l'ouvrir. Alors je vais ouvrir la naissance pour choisir ? Être rejeté par certaines personnes est un choix commode du présent pour ressentir une douleur comme la sienne !
-
-L'entreprise elle-même est une entreprise très prospère. Personne ne prend même la peine de l'ouvrir. Alors je vais ouvrir la naissance pour choisir ? Être rejeté par certaines personnes est un choix commode du présent pour ressentir une douleur comme la sienne !
diff --git a/src/content/blog/english/post-1.md b/src/content/blog/post-1.md
similarity index 100%
rename from src/content/blog/english/post-1.md
rename to src/content/blog/post-1.md
diff --git a/src/content/blog/english/post-2.md b/src/content/blog/post-2.md
similarity index 100%
rename from src/content/blog/english/post-2.md
rename to src/content/blog/post-2.md
diff --git a/src/content/blog/english/post-3.md b/src/content/blog/post-3.md
similarity index 100%
rename from src/content/blog/english/post-3.md
rename to src/content/blog/post-3.md
diff --git a/src/content/blog/english/post-4.md b/src/content/blog/post-4.md
similarity index 100%
rename from src/content/blog/english/post-4.md
rename to src/content/blog/post-4.md
diff --git a/src/content/config.ts b/src/content/config.ts
index c690a41..6b926a5 100755
--- a/src/content/config.ts
+++ b/src/content/config.ts
@@ -1,6 +1,6 @@
import { defineCollection, z } from "astro:content";
-// Blog collection schema
+// Post collection schema
const blogCollection = defineCollection({
schema: z.object({
title: z.string(),
@@ -49,96 +49,9 @@ const pagesCollection = defineCollection({
}),
});
-// Contact collection schema
-const contactCollection = defineCollection({
- schema: z.object({
- title: z.string(),
- meta_title: z.string().optional(),
- description: z.string(),
- image: z.string().optional(),
- draft: z.boolean().optional(),
- }),
-});
-
-// About collection schema
-const aboutCollection = defineCollection({
- schema: z.object({
- title: z.string(),
- meta_title: z.string().optional(),
- description: z.string().optional(),
- image: z.string(),
- draft: z.boolean().optional(),
- }),
-});
-
-// Banner schema
-const bannerSchema = z.object({
- title: z.string(),
- content: z.string(),
- image: z.string(),
- button: z.object({
- enable: z.boolean(),
- label: z.string(),
- link: z.string(),
- }),
-});
-
-// Features schema
-const featureSchema = z.object({
- title: z.string(),
- image: z.string(),
- content: z.string(),
- bulletpoints: z.array(z.string()),
- button: z.object({
- enable: z.boolean(),
- label: z.string().optional(),
- link: z.string().optional(),
- }),
-});
-
-// Content schema (for the main content structure with banner and features)
-const contentSchema = z.object({
- banner: bannerSchema,
- features: z.array(featureSchema),
-});
-
-// Content collection schema
-const contentCollection = defineCollection({
- schema: contentSchema,
-});
-
-// Testimonial schema
-const testimonialSchema = z.object({
- name: z.string(),
- designation: z.string(),
- avatar: z.string(),
- content: z.string(),
-});
-
-// Testimonials schema
-const testimonialsSchema = z.array(testimonialSchema);
-
-// Call to Action schema
-const callToActionSchema = z.object({
- enable: z.boolean(),
- title: z.string(),
- image: z.string(),
- description: z.string(),
- button: z.object({
- enable: z.boolean(),
- label: z.string(),
- link: z.string().url(),
- }),
-});
-
// Export collections
export const collections = {
blog: blogCollection,
authors: authorsCollection,
pages: pagesCollection,
- contact: contactCollection,
- about: aboutCollection,
- content: contentCollection,
- testimonials: testimonialsSchema,
- callToAction: callToActionSchema,
};
diff --git a/src/content/contact/english/-index.md b/src/content/contact/-index.md
similarity index 100%
rename from src/content/contact/english/-index.md
rename to src/content/contact/-index.md
diff --git a/src/content/contact/french/-index.md b/src/content/contact/french/-index.md
deleted file mode 100644
index bd6b9f6..0000000
--- a/src/content/contact/french/-index.md
+++ /dev/null
@@ -1,6 +0,0 @@
----
-title: "Contact"
-meta_title: ""
-description: "this is meta description"
-draft: false
----
diff --git a/src/content/homepage/english/-index.md b/src/content/homepage/-index.md
similarity index 100%
rename from src/content/homepage/english/-index.md
rename to src/content/homepage/-index.md
diff --git a/src/content/homepage/french/-index.md b/src/content/homepage/french/-index.md
deleted file mode 100755
index be96b3f..0000000
--- a/src/content/homepage/french/-index.md
+++ /dev/null
@@ -1,53 +0,0 @@
----
-# Banner
-banner:
- title: "Le modèle de démarrage ultime dont vous avez besoin pour démarrer votre projet Astro"
- content: "Astroplate est un modèle de démarrage gratuit construit avec Astro et TailwindCSS, fournissant tout ce dont vous avez besoin pour démarrer votre projet Astro et gagner un temps précieux."
- image: "/images/banner.png"
- button:
- enable: true
- label: "Commencer gratuitement"
- link: "https://github.com/zeon-studio/astroplate"
-
-# Features
-features:
- - title: "Ce qui est inclus dans Astroplate"
- image: "/images/service-1.png"
- content: "Astroplate est un modèle de démarrage complet qui inclut tout ce dont vous avez besoin pour démarrer votre projet Astro. Ce qui est inclus dans Astroplate"
- bulletpoints:
- - "10+ pages pré-construites"
- - "Score Google Pagespeed de 95+"
- - "Construit avec Astro et TailwindCSS pour un style facile et personnalisable"
- - "Entièrement responsive sur tous les appareils"
- - "Optimisé pour le référencement pour de meilleurs classements dans les moteurs de recherche"
- - "**Open-source et gratuit** pour une utilisation personnelle et commerciale"
- button:
- enable: false
- label: "Commencer maintenant"
- link: "#"
-
- - title: "Découvrez les fonctionnalités clés d'Astro"
- image: "/images/service-2.png"
- content: "Astro est un framework web tout-en-un pour construire des sites web rapides et centrés sur le contenu. Il offre une gamme de fonctionnalités excitantes pour les développeurs et les créateurs de sites web. Certaines des fonctionnalités clés sont :"
- bulletpoints:
- - "Zéro JS, par défaut : Aucun surcoût d'exécution JavaScript pour vous ralentir."
- - "Personnalisable : Tailwind, MDX et plus de 100 autres intégrations au choix."
- - "Agnostique à l'UI : Supporte React, Preact, Svelte, Vue, Solid, Lit et plus encore."
- button:
- enable: true
- label: "Commencer maintenant"
- link: "https://github.com/zeon-studio/astroplate"
-
- - title: "Les principales raisons de choisir Astro pour votre prochain projet"
- image: "/images/service-3.png"
- content: "Avec Astro, vous pouvez construire des sites web modernes et centrés sur le contenu sans sacrifier la performance ou la facilité d'utilisation."
- bulletpoints:
- - "Charge instantanée des sites statiques pour une meilleure expérience utilisateur et SEO."
- - "Syntaxe intuitive et support pour les frameworks populaires rendent l'apprentissage et l'utilisation d'Astro un jeu d'enfant."
- - "Utilisez n'importe quelle bibliothèque ou framework front-end, ou construisez des composants personnalisés, pour tout type de projet."
- - "Construit sur une technologie de pointe pour garder vos projets à jour avec les dernières normes web."
- button:
- enable: false
- label: ""
- link: ""
----
diff --git a/src/content/pages/english/elements.mdx b/src/content/pages/elements.mdx
similarity index 100%
rename from src/content/pages/english/elements.mdx
rename to src/content/pages/elements.mdx
diff --git a/src/content/pages/french/elements.mdx b/src/content/pages/french/elements.mdx
deleted file mode 100755
index c0301a3..0000000
--- a/src/content/pages/french/elements.mdx
+++ /dev/null
@@ -1,255 +0,0 @@
----
-title: "Éléments"
-meta_title: ""
-description: "Ceci est une méta-description"
-draft: false
----
-
-# Titre 1
-
-## Titre 2
-
-### Titre 3
-
-#### Titre 4
-
-##### Titre 5
-
-###### Titre 6
-
----
-
-### Paragraphe
-
-Êtes-vous venu ici pour quelque chose en particulier ou juste pour critiquer Riker? Et en entrant à vitesse maximale, vous êtes apparu pour un instant être à deux endroits à la fois. Nous avons un saboteur à bord. Nous savons que vous vous occupez de minerai volé. Mais je veux parler de la tentative d'assassinat sur le Lieutenant Worf. Quelqu'un pourrait-il survivre dans un tampon de téléporteur pendant 75 ans? Le destin. Il protège les fous, les petits enfants et les navires.
-
-Êtes-vous venu ici pour quelque chose en particulier ou juste pour critiquer Riker? Et en entrant à vitesse maximale, vous êtes apparu pour un instant être à deux endroits à la fois. Nous avons un saboteur à bord. Nous savons que vous vous occupez de minerai volé. Mais je veux parler de la tentative d'assassinat sur le Lieutenant Worf. Quelqu'un pourrait-il survivre dans un tampon de téléporteur pendant 75 ans? Le destin. Il protège les fous, les petits enfants et les navires.
-
----
-
-### Emphase
-
-1. Êtes-vous venu ici pour quelque chose en **particulier** ou juste en général
-
-2. Êtes-vous venu ici pour quelque chose en particulier
-
-3. _Êtes-vous venu ici_
-
-4. Êtes-vous venu ici pour **quelque chose** en particulier
-
-5. Êtes-vous venu ici pour quelque chose en particulier
-
-6. Êtes-vous venu ici pour quelque chose en particulier
-
-7. Les URLs et les URLs entre crochets seront automatiquement transformées en liens. [http://www.example.com](http://www.example.com) ou
-
-8. [http://www.example.com](http://www.example.com) et parfois example.com (mais pas sur Github, par exemple).
-
----
-
-### Lien
-
-[Je suis un lien en ligne](https://www.google.com)
-
-[Je suis un lien en ligne avec titre](https://www.google.com "Page d'accueil de Google")
-
-[Je suis un lien de référence][texte de référence insensible à la casse]
-
-[Je suis une référence relative à un fichier de dépôt](../blob/master/LICENSE)
-
-[Vous pouvez utiliser des chiffres pour les définitions de liens de référence][1]
-
-Ou laissez-le vide et utilisez [le texte du lien lui-même].
-
-example.com (mais pas sur Github, par exemple).
-
-Du texte pour montrer que les liens de référence peuvent suivre plus tard.
-
-[texte de référence insensible à la casse]: https://www.themefisher.com
-[1]: https://gethugothemes.com
-[le texte du lien lui-même]: https://www.getjekyllthemes.com
-
----
-
-### Liste Ordonnée
-
-1. Élément de liste
-2. Élément de liste
-3. Élément de liste
-4. Élément de liste
-5. Élément de liste
-
----
-
-### Liste Non Ordonnée
-
-- Élément de liste
-- Élément de liste
-- Élément de liste
-- Élément de liste
-- Élément de liste
-
----
-
-### Code and Syntax Highlighting
-
-#### HTML
-
-```html
-
-```
-
----
-
-#### CSS
-
-```css
-img {
- vertical-align: middle;
- border: 0;
- max-width: 100%;
- height: auto;
-}
-```
-
----
-
-#### JavaScript
-
-```javascript
-window.addEventListener("load", (e) => {
- document.querySelector(".preloader").style.display = "none";
-});
-```
-
----
-
-### Button
-
-
-
----
-
-### Quote
-
-> Êtes-vous venu ici pour quelque chose en particulier ou simplement pour dénigrer Riker en général ? Et en soufflant à la vitesse de distorsion maximale, vous avez semblé pendant un instant être à deux endroits à la fois.
-
----
-
-### Notice
-
-Ceci est une simple remarque.
-
-Ceci est une simple remarque.
-
-Ceci est une simple remarque.
-
-Ceci est une simple remarque.
-
----
-
-### Tab
-
-
-
-
-
-#### Did you come here for something in particular?
-
-Êtes-vous venu ici pour quelque chose en particulier ou simplement pour dénigrer Riker en général ? Et en soufflant à la vitesse de distorsion maximale, vous avez semblé pendant un instant être à deux endroits à la fois. Nous avons un saboteur à bord. Nous savons que vous faites du trafic de minerai volé. Mais je veux parler de la tentative d'assassinat du lieutenant Worf.
-
-
-
-
-
-#### I wanna talk about the assassination attempt
-
-La douleur elle-même est grande, l'élitr sadipscing est réglé, mais les diam nonumy eirmo pendant un temps ils envient qu'avec le travail et la douleur c'était quelque chose de grand, mais le diam voluptiva. Mais en effet, je les accuserai et seulement deux douleurs et je les reprendrai. Stet clita kasd gubergren, aucun takimata de mer n'est sacré.
-
-La douleur elle-même est grande, l'élitr sadipscing est réglé, mais les diam nonumy eirmo pendant un temps ils envient qu'avec le travail et la douleur c'était quelque chose de grand, mais le diam voluptiva. Mais en effet, je les accuserai et seulement deux douleurs et je les reprendrai. Stet clita kasd gubergren, aucun takimata de mer n'est sacré.
-
-
-
-
-
-#### We know you’re dealing in stolen ore
-
-La douleur elle-même est grande, l'élitr sadipscing est réglé, mais les diam nonumy eirmo pendant un temps ils envient qu'avec le travail et la douleur c'était quelque chose de grand, mais le diam voluptiva. Mais en effet, je les accuserai et seulement deux douleurs et je les reprendrai. Stet clita kasd gubergren, aucun takimata de mer n'est sacré.
-
-La douleur elle-même est grande, l'élitr sadipscing est réglé, mais les diam nonumy eirmo pendant un temps ils envient qu'avec le travail et la douleur c'était quelque chose de grand, mais le diam voluptiva. Mais en effet, je les accuserai et seulement deux douleurs et je les reprendrai. Stet clita kasd gubergren, aucun takimata de mer n'est sacré.
-
-
-
-
-
----
-
-### Table
-
-| # | First | Last | Handle |
-| :-- | :----------: | :----------: | -----------: |
-| 1 | Row:1 Cell:1 | Row:1 Cell:2 | Row:1 Cell:3 |
-| 2 | Row:2 Cell:1 | Row:2 Cell:2 | Row:2 Cell:3 |
-| 3 | Row:3 Cell:1 | Row:3 Cell:2 | Row:3 Cell:3 |
-
----
-
-### Accordion
-
-
-
-- C'est une chose.
-- C'est une chose.
-- C'est une chose.
-- C'est une chose.
-- C'est une chose.
-
-
-
-
-
-- C'est une chose.
-- C'est une chose.
-- C'est une chose.
-- C'est une chose.
-- C'est une chose.
-
-
-
-
-
-- C'est une chose.
-- C'est une chose.
-- C'est une chose.
-- C'est une chose.
-- C'est une chose.
-
-
-
----
-
-### Image
-
-
-
----
-
-### Youtube video
-
-
-
----
-
-### Custom video
-
-
diff --git a/src/content/pages/french/privacy-policy.md b/src/content/pages/french/privacy-policy.md
deleted file mode 100644
index 8077b19..0000000
--- a/src/content/pages/french/privacy-policy.md
+++ /dev/null
@@ -1,30 +0,0 @@
----
-title: "Confidentialité"
-meta_title: ""
-description: "this is meta description"
-draft: false
----
-
-#### Responsabilité des contributeurs
-
-Le client est très important, le client sera suivi par le client. Purus, jusqu'à présent tu es eros, ullamcorper id feugiat chaque personne avec quelques flèches. J'étais laide, mais la masse des dessins animés était grosse d'un frémissement. Je ne veux pas de la douleur d’un footballeur puissant. Ultrices amoat, dans sera traité de l'arc du lit de la maladie. Il a été touché par des flèches lors d'un cours de torture. Le problème avec la fondue, c'est qu'il avait besoin de chocolat. Maintenant le bureau mais parfois le lac. Mais qui se soucie des dessins animés
-
-le prix peut être certain. C'est un élément très important, tincidunt eros, nibh en lion. Malesuada est un lac pur, mais suspendu pendant un certain temps. Qui se soucie du temps, veut naître. Mais il faut en prendre soin. Eu veut naître du souci erhdfvssfvrgss a besoin de dessins animés et d'éléments. Un lac dans lequel il est facile de se baigner.
-
-#### Collecte d'informations personnelles
-
-Le client est très important, le client sera suivi par le client. Purus, jusqu'à présent tu es eros, ullamcorper id feugiat chaque personne avec quelques flèches. J'étais laide, mais la masse des dessins animés était grosse d'un frémissement. Ne me donne pas la douleur d'un joueur de football puissant. Les ultrices vont être guéries par l'arc du lit de la maladie. Il a été touché par des flèches lors d'un cours de torture. Le problème avec la fondue, c'est qu'il avait besoin de chocolat. Maintenant le bureau mais parfois le lac. Mais qui se soucie des dessins animés ?
-
-#### Protection des informations personnelles
-
-Le client est très important, le client sera suivi par le client. Purus, jusqu'à présent tu es eros, ullamcorper id feugiat chaque personne avec quelques flèches. J'étais laide, mais la masse des dessins animés était grosse d'un frémissement. Je ne veux pas de la douleur d’un footballeur puissant. Les ultrices vont être guéries par l'arc du lit de la maladie. Il a été touché par des flèches lors d'un cours de macro.
-
-Le problème avec la marmite, c'était qu'il avait besoin de chocolat. Maintenant le bureau mais parfois le lac. Mais qui se soucie des dessins animés ?
-Le client est très important, le client sera suivi par le client. Purus, jusqu'à maintenant tu es eros, ullamcorper id feugiat
-
-#### Modifications de la politique de confidentialité
-
-1. Tous les articles Themefisher sont conçus pour être les plus récents, nous vérifions tous
-2. commentaires qui menacent ou nuisent à la réputation de toute personne ou organisation
-3. informations personnelles, y compris, sans toutefois s'y limiter, les adresses e-mail et les numéros de téléphone
-4. Toute mise à jour arrive. Le client technologique recevra une notification automatique.
\ No newline at end of file
diff --git a/src/content/pages/english/privacy-policy.md b/src/content/pages/privacy-policy.md
similarity index 100%
rename from src/content/pages/english/privacy-policy.md
rename to src/content/pages/privacy-policy.md
diff --git a/src/content/sections/english/call-to-action.md b/src/content/sections/call-to-action.md
similarity index 100%
rename from src/content/sections/english/call-to-action.md
rename to src/content/sections/call-to-action.md
diff --git a/src/content/sections/french/call-to-action.md b/src/content/sections/french/call-to-action.md
deleted file mode 100644
index c7a241b..0000000
--- a/src/content/sections/french/call-to-action.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-enable: true
-title: "Prêt à construire votre prochain projet avec Astro ?"
-image: "/images/call-to-action.png"
-description: "Expérimente le futur du développement web avec Astroplate et Astro. Créez des sites statiques à charge rapide et personnalisables en toute facilité."
-button:
- enable: true
- label: "Commencez maintenant"
- link: "https://github.com/zeon-studio/astroplate"
----
diff --git a/src/content/sections/french/testimonial.md b/src/content/sections/french/testimonial.md
deleted file mode 100644
index 0f62df6..0000000
--- a/src/content/sections/french/testimonial.md
+++ /dev/null
@@ -1,27 +0,0 @@
----
-enable: true
-title: "Ce que disent les utilisateurs d'Astroplate"
-description: "Ne vous contentez pas de nous croire sur parole - écoutez certains de nos utilisateurs satisfaits ! Consultez quelques-uns de nos témoignages ci-dessous pour voir ce que les autres disent à propos d'Astroplate."
-
-# Testimonials
-testimonials:
- - name: "Marvin McKinney"
- designation: "Concepteur Web"
- avatar: "/images/avatar-sm.png"
- content: "Lorem ipsum dolor sit amet consectetur adipisicing elit. Qui iusto illo molestias, assumenda expedita commodi inventore non itaque molestiae voluptatum dolore, facilis sapiente, repellat veniam."
-
- - name: "Marvin McKinney"
- designation: "Concepteur Web"
- avatar: "/images/avatar-sm.png"
- content: "Lorem ipsum dolor sit amet consectetur adipisicing elit. Qui iusto illo molestias, assumenda expedita commodi inventore non itaque molestiae voluptatum dolore, facilis sapiente, repellat veniam."
-
- - name: "Marvin McKinney"
- designation: "Concepteur Web"
- avatar: "/images/avatar-sm.png"
- content: "Lorem ipsum dolor sit amet consectetur adipisicing elit. Qui iusto illo molestias, assumenda expedita commodi inventore non itaque molestiae voluptatum dolore, facilis sapiente, repellat veniam."
-
- - name: "Marvin McKinney"
- designation: "Concepteur Web"
- avatar: "/images/avatar-sm.png"
- content: "Lorem ipsum dolor sit amet consectetur adipisicing elit. Qui iusto illo molestias, assumenda expedita commodi inventore non itaque molestiae voluptatum dolore, facilis sapiente, repellat veniam."
----
diff --git a/src/content/sections/english/testimonial.md b/src/content/sections/testimonial.md
similarity index 100%
rename from src/content/sections/english/testimonial.md
rename to src/content/sections/testimonial.md
diff --git a/src/i18n/en.json b/src/i18n/en.json
deleted file mode 100644
index 64f04bf..0000000
--- a/src/i18n/en.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "full_name": "Full Name",
- "full_name_placeholder": "Enter your full name",
- "mail_placeholder": "john.doe@email.com",
- "message": "Anything else?",
- "message_placeholder": "Your message here...",
- "submit": "Submit",
- "read_more": "Read More",
- "page_not_found": "Page Not Found",
- "working_mail": "Work Email",
- "anything_else": "Anything else?",
- "contact_message_placeholder": "Your message here...",
- "page_not_found_content": "The page you are looking for may have been removed, renamed, or is temporarily unavailable.",
- "back_to_home": "Back to Home",
- "get_started": "Get Started"
-}
diff --git a/src/i18n/fr.json b/src/i18n/fr.json
deleted file mode 100644
index 62f4e06..0000000
--- a/src/i18n/fr.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "full_name": "Nom complet",
- "full_name_placeholder": "Entrez votre nom complet",
- "mail_placeholder": "john.doe@email.com",
- "message": "Autre chose?",
- "message_placeholder": "Votre message ici...",
- "submit": "Soumettre",
- "read_more": "Lire la suite",
- "page_not_found": "Page non trouvée",
- "working_mail": "Courrier de travail",
- "anything_else": "Autre chose ?",
- "contact_message_placeholder": "Votre message ici...",
- "page_not_found_content": "La page que vous recherchez a peut-être été supprimée, changée de nom ou temporairement inaccessible.",
- "back_to_home": "Retour à l'accueil",
- "get_started": "Commencez à utiliser"
-}
diff --git a/src/layouts/Base.astro b/src/layouts/Base.astro
index b07a8e9..5c189eb 100755
--- a/src/layouts/Base.astro
+++ b/src/layouts/Base.astro
@@ -9,7 +9,6 @@ import "@/styles/main.scss";
import { AstroFont } from "astro-font";
import { ViewTransitions } from "astro:transitions";
import SearchModal from "./helpers/SearchModal";
-import { getLangFromUrl } from "@/lib/utils/languageParser";
// font families
const pf = theme.fonts.font_family.primary;
@@ -19,12 +18,12 @@ let fontPrimary, fontSecondary;
if (theme.fonts.font_family.primary) {
fontPrimary = theme.fonts.font_family.primary
.replace(/\+/g, " ")
- .replace(/:[ital,]*[ital@]*[wght@]*[0-9,;]+/gi, "");
+ .replace(/:[ital,]*[ital@]*[wght@]*[0-9,;.]+/gi, "");
}
if (theme.fonts.font_family.secondary) {
fontSecondary = theme.fonts.font_family.secondary
.replace(/\+/g, " ")
- .replace(/:[ital,]*[ital@]*[wght@]*[0-9,;]+/gi, "");
+ .replace(/:[ital,]*[ital@]*[wght@]*[0-9,;.]+/gi, "");
}
// types for frontmatters
@@ -35,18 +34,15 @@ export interface Props {
image?: string;
noindex?: boolean;
canonical?: string;
- lang?: string;
}
-// distructure frontmatters
-const { title, meta_title, description, image, noindex, canonical, lang } =
+// destructure frontmatter
+const { title, meta_title, description, image, noindex, canonical } =
Astro.props;
-
-const language = lang || getLangFromUrl(Astro.url);
---
-
+
@@ -111,7 +107,7 @@ const language = lang || getLangFromUrl(Astro.url);
@@ -124,7 +120,7 @@ const language = lang || getLangFromUrl(Astro.url);
@@ -132,7 +128,7 @@ const language = lang || getLangFromUrl(Astro.url);
@@ -145,7 +141,7 @@ const language = lang || getLangFromUrl(Astro.url);
@@ -153,7 +149,7 @@ const language = lang || getLangFromUrl(Astro.url);
@@ -177,7 +173,7 @@ const language = lang || getLangFromUrl(Astro.url);
-
+
diff --git a/src/layouts/PostSingle.astro b/src/layouts/PostSingle.astro
index 66d66bf..5f59a02 100755
--- a/src/layouts/PostSingle.astro
+++ b/src/layouts/PostSingle.astro
@@ -1,30 +1,18 @@
---
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 { slugSelector } from "@/lib/utils/languageParser";
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;
-let { lang } = Astro.params;
-if (!lang) {
- lang = default_language;
-}
-
-const posts = await getSinglePage(
- COLLECTION_FOLDER,
- lang as keyof ContentEntryMap
-);
+const posts = await getSinglePage(COLLECTION_FOLDER);
const similarPosts = similarItems(post, posts);
const { Content } = await post.render();
const { title, description, author, categories, image, date, tags } = post.data;
@@ -51,7 +39,7 @@ const { title, description, author, categories, image, date, tags } = post.data;
-
+
{humanize(author)}
@@ -60,9 +48,7 @@ const { title, description, author, categories, image, date, tags } = post.data;
{
categories.map((category: string, index: number) => (
-
+
{humanize(category)}
{index !== categories.length - 1 && ","}
@@ -86,7 +72,7 @@ const { title, description, author, categories, image, date, tags } = post.data;
{humanize(tag)}
diff --git a/src/layouts/components/AuthorCard.astro b/src/layouts/components/AuthorCard.astro
index 374acf9..bd00f86 100644
--- a/src/layouts/components/AuthorCard.astro
+++ b/src/layouts/components/AuthorCard.astro
@@ -1,12 +1,10 @@
---
-import { getLangFromUrl, slugSelector } from "@/lib/utils/languageParser";
import { plainify } from "@/lib/utils/textConverter";
import ImageMod from "./ImageMod.astro";
import Social from "./Social.astro";
const { data } = Astro.props;
const { title, image, social } = data.data;
-const lang = getLangFromUrl(Astro.url);
---
-
{title}
+
{title}
{plainify(data.body?.slice(0, 100))}
diff --git a/src/layouts/components/BlogCard.astro b/src/layouts/components/BlogCard.astro
index eb15361..268a532 100644
--- a/src/layouts/components/BlogCard.astro
+++ b/src/layouts/components/BlogCard.astro
@@ -1,28 +1,16 @@
---
import config from "@/config/config.json";
import dateFormat from "@/lib/utils/dateFormat";
-import {
- getLangFromUrl,
- getTranslations,
- slugSelector,
-} from "@/lib/utils/languageParser";
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";
-const { summary_length }: { summary_length: number; blog_folder: string } =
- config.settings;
+const {
+ summary_length,
+ blog_folder,
+}: { summary_length: number; blog_folder: string } = config.settings;
const { data } = Astro.props;
const { title, image, date, author, categories } = data.data;
-
-const lang = getLangFromUrl(Astro.url);
-const { read_more } = await getTranslations(lang as keyof ContentEntryMap);
-
-const slugParts = data.slug.split("/");
-slugParts[0] = "blog";
-const modifiedSlug = slugParts.join("/");
-data.slug = modifiedSlug;
---
@@ -39,23 +27,22 @@ data.slug = modifiedSlug;
)
}
diff --git a/src/layouts/components/Breadcrumbs.astro b/src/layouts/components/Breadcrumbs.astro
index 29e0448..ed67ed1 100644
--- a/src/layouts/components/Breadcrumbs.astro
+++ b/src/layouts/components/Breadcrumbs.astro
@@ -1,30 +1,19 @@
---
-import { supportedLang } from "@/lib/utils/languageParser";
import { humanize } from "@/lib/utils/textConverter";
const { className }: { className?: string } = Astro.props;
const paths = Astro.url.pathname.split("/").filter((x) => x);
-
-let lang = "";
-if (supportedLang.includes(paths[0])) {
- lang = paths.shift()!;
-}
-
-let baseHref = lang ? `/${lang}` : "/";
let parts = [
{
label: "Home",
- href: baseHref,
- "aria-label":
- Astro.url.pathname === baseHref || Astro.url.pathname === `${baseHref}/`
- ? "page"
- : undefined,
+ href: "/",
+ "aria-label": Astro.url.pathname === "/" ? "page" : undefined,
},
];
paths.forEach((label: string, i: number) => {
- const href = `${baseHref}${paths.slice(0, i + 1).join("/")}`;
+ const href = `/${paths.slice(0, i + 1).join("/")}`;
label !== "page" &&
parts.push({
label: humanize(label.replace(".html", "").replace(/[-_]/g, " ")) || "",
@@ -39,7 +28,7 @@ paths.forEach((label: string, i: number) => {
{
parts.map(({ label, ...attrs }, index) => (
- {index > 0 && / }
+ {index > 0 && / }
{index !== parts.length - 1 ? (
{label}
diff --git a/src/layouts/components/Logo.astro b/src/layouts/components/Logo.astro
index 730d0c7..8b7ba5c 100644
--- a/src/layouts/components/Logo.astro
+++ b/src/layouts/components/Logo.astro
@@ -1,7 +1,6 @@
---
import config from "@/config/config.json";
import ImageMod from "./ImageMod.astro";
-import { getLangFromUrl, slugSelector } from "@/lib/utils/languageParser";
const { src, srcDarkmode }: { src?: string; srcDarkmode?: string } =
Astro.props;
@@ -22,17 +21,9 @@ const {
} = config.site;
const { theme_switcher }: { theme_switcher: boolean } = config.settings;
-const { default_language } = config.settings;
-
-let lang = getLangFromUrl(Astro.url);
-
-const disabledLanguages = config.settings.disable_languages as string[];
-if (disabledLanguages.includes(lang)) {
- lang = default_language;
-}
---
-
+
{
src || srcDarkmode || logo || logo_darkmode ? (
<>
diff --git a/src/layouts/components/Pagination.astro b/src/layouts/components/Pagination.astro
index 8bf80f8..3e42979 100644
--- a/src/layouts/components/Pagination.astro
+++ b/src/layouts/components/Pagination.astro
@@ -1,8 +1,4 @@
---
-import { getLangFromUrl, slugSelector } from "@/lib/utils/languageParser";
-
-const lang = getLangFromUrl(Astro.url);
-
type Pagination = {
section?: string;
currentPage?: number;
@@ -31,11 +27,8 @@ for (let i = 1; i <= totalPages; i++) {
@@ -84,12 +77,11 @@ for (let i = 1; i <= totalPages; i++) {
) : (
@@ -101,10 +93,7 @@ for (let i = 1; i <= totalPages; i++) {
{/* next page */}
{hasNextPage ? (
Next
diff --git a/src/layouts/components/ThemeSwitcher.astro b/src/layouts/components/ThemeSwitcher.astro
index 27c08ee..2f10b2c 100755
--- a/src/layouts/components/ThemeSwitcher.astro
+++ b/src/layouts/components/ThemeSwitcher.astro
@@ -1,8 +1,10 @@
---
import config from "@/config/config.json";
-const { theme_switcher }: { theme_switcher: boolean; default_theme: string } =
- config.settings;
+const {
+ theme_switcher,
+ default_theme,
+}: { theme_switcher: boolean; default_theme: string } = config.settings;
const { className }: { className?: string } = Astro.props;
---
@@ -47,7 +49,7 @@ const { className }: { className?: string } = Astro.props;
const matchMedia = window.matchMedia("(prefers-color-scheme: dark)");
matchMedia.addEventListener("change", () =>
- toggleTheme(document.querySelectorAll("[data-theme-switcher]")),
+ toggleTheme(document.querySelectorAll("[data-theme-switcher]"))
);
function toggleTheme(themeSwitch: NodeListOf) {
diff --git a/src/layouts/helpers/LanguageSwitcher.tsx b/src/layouts/helpers/LanguageSwitcher.tsx
deleted file mode 100644
index e268ab9..0000000
--- a/src/layouts/helpers/LanguageSwitcher.tsx
+++ /dev/null
@@ -1,65 +0,0 @@
-import config from "@/config/config.json";
-import languages from "@/config/language.json";
-import React from "react";
-
-const LanguageSwitcher = ({
- lang,
- pathname,
-}: {
- lang: string;
- pathname: string;
-}) => {
- const { default_language, default_language_in_subdir } = config.settings;
-
- // Function to remove trailing slash if necessary
- const removeTrailingSlash = (path: string) => {
- if (!config.site.trailing_slash) {
- return path.replace(/\/$/, "");
- }
- return path;
- };
-
- // Sort languages by weight and filter out disabled languages
- const sortedLanguages = languages
- // @ts-ignore
- .filter(language => !config.settings.disable_languages.includes(language.languageCode))
- .sort((a, b) => a.weight - b.weight);
-
- return (
- 1 ? "block" : "hidden"}`}>
- {
- const selectedLang = e.target.value;
- let newPath;
- const baseUrl = window.location.origin;
-
- if (selectedLang === default_language) {
- if (default_language_in_subdir) {
- newPath = `${baseUrl}/${default_language}${removeTrailingSlash(pathname.replace(`/${lang}`, ""))}`;
- } else {
- newPath = `${baseUrl}${removeTrailingSlash(pathname.replace(`/${lang}`, ""))}`;
- }
- } else {
- newPath = `/${selectedLang}${removeTrailingSlash(pathname.replace(`/${lang}`, ""))}`;
- }
-
- window.location.href = newPath;
- }}
- value={lang}
- >
- {sortedLanguages.map((language) => (
-
- {language.languageName}
-
- ))}
-
-
- );
-};
-
-export default LanguageSwitcher;
diff --git a/src/layouts/helpers/SearchModal.tsx b/src/layouts/helpers/SearchModal.tsx
index f095d7f..6d29287 100644
--- a/src/layouts/helpers/SearchModal.tsx
+++ b/src/layouts/helpers/SearchModal.tsx
@@ -1,11 +1,8 @@
import searchData from ".json/search.json";
import React, { useEffect, useState } from "react";
import SearchResult, { type ISearchItem } from "./SearchResult";
-import config from "@/config/config.json";
-const { default_language } = config.settings;
-const SearchModal = ({ lang }: { lang: string | undefined }) => {
- lang = lang || default_language;
+const SearchModal = () => {
const [searchString, setSearchString] = useState("");
// handle input change
@@ -42,13 +39,9 @@ const SearchModal = ({ lang }: { lang: string | undefined }) => {
}
};
- // filter language specific search data
- const filterSearchData = searchData.filter((item) => item.lang === lang);
-
-
// get search result
const startTime = performance.now();
- const searchResult = doSearch(filterSearchData);
+ const searchResult = doSearch(searchData);
const endTime = performance.now();
const totalTime = ((endTime - startTime) / 1000).toFixed(3);
@@ -176,15 +169,10 @@ const SearchModal = ({ lang }: { lang: string | undefined }) => {
name="search"
value={searchString}
onChange={handleSearch}
- autoFocus
autoComplete="off"
/>
-
+
diff --git a/src/layouts/helpers/SearchResult.tsx b/src/layouts/helpers/SearchResult.tsx
index 810cc3c..6c0efae 100755
--- a/src/layouts/helpers/SearchResult.tsx
+++ b/src/layouts/helpers/SearchResult.tsx
@@ -1,9 +1,7 @@
-import { slugSelector } from "@/lib/utils/languageParser";
import { plainify, titleify } from "@/lib/utils/textConverter";
import React from "react";
export interface ISearchItem {
- lang: string;
group: string;
slug: string;
frontmatter: {
@@ -35,13 +33,10 @@ export interface ISearchGroup {
const SearchResult = ({
searchResult,
searchString,
- lang
}: {
searchResult: ISearchItem[];
searchString: string;
- lang: string;
}) => {
-
// generate search result group
const generateSearchGroup = (searchResult: ISearchItem[]) => {
const joinDataByGroup: ISearchGroup[] = searchResult.reduce(
@@ -88,7 +83,6 @@ const SearchResult = ({
);
};
-
// match underline
const matchUnderline = (text: string, substring: string) => {
const parts = text?.split(new RegExp(`(${substring})`, "gi"));
@@ -154,14 +148,12 @@ const SearchResult = ({
)}
{matchUnderline(item.frontmatter.title, searchString)}
@@ -196,8 +188,8 @@ const SearchResult = ({
{matchUnderline(category, searchString)}
{item.frontmatter.categories &&
index !==
- item.frontmatter.categories.length -
- 1 && <>, >}
+ item.frontmatter.categories.length -
+ 1 && <>, >}
),
)}
@@ -219,7 +211,7 @@ const SearchResult = ({
{matchUnderline(tag, searchString)}
{item.frontmatter.tags &&
index !==
- item.frontmatter.tags.length - 1 && <>, >}
+ item.frontmatter.tags.length - 1 && <>, >}
))}
diff --git a/src/layouts/partials/Footer.astro b/src/layouts/partials/Footer.astro
index 09d6912..cd1b641 100755
--- a/src/layouts/partials/Footer.astro
+++ b/src/layouts/partials/Footer.astro
@@ -2,21 +2,11 @@
import Logo from "@/components/Logo.astro";
import Social from "@/components/Social.astro";
import config from "@/config/config.json";
+import menu from "@/config/menu.json";
import social from "@/config/social.json";
-import {
- getLangFromUrl,
- getTranslations,
- slugSelector,
-} from "@/lib/utils/languageParser";
import { markdownify } from "@/lib/utils/textConverter";
-import type { ContentEntryMap } from "astro:content";
-const lang = getLangFromUrl(Astro.url);
-const menu = await getTranslations(lang as keyof ContentEntryMap);
-let footer: any = [];
-if (menu) {
- footer = menu.footer;
-}
+const { footer }: { footer: { name: string; url: string }[] } = menu;
---
@@ -28,9 +18,9 @@ if (menu) {
{
- footer.map((menu: any) => (
+ footer.map((menu) => (
- {menu.name}
+ {menu.name}
))
}
diff --git a/src/layouts/partials/Header.astro b/src/layouts/partials/Header.astro
index 8841106..136e356 100755
--- a/src/layouts/partials/Header.astro
+++ b/src/layouts/partials/Header.astro
@@ -2,36 +2,33 @@
import Logo from "@/components/Logo.astro";
import ThemeSwitcher from "@/components/ThemeSwitcher.astro";
import config from "@/config/config.json";
-import LanguageSwitcher from "@/helpers/LanguageSwitcher";
-import {
- getLangFromUrl,
- getTranslations,
- slugSelector,
-} from "@/lib/utils/languageParser";
-import type { ContentEntryMap } from "astro:content";
+import menu from "@/config/menu.json";
import { IoSearch } from "react-icons/io5";
-let lang = getLangFromUrl(Astro.url);
-const menu = await getTranslations(lang as keyof ContentEntryMap);
-
-const { navigation_button, settings } = config;
-const { default_language } = config.settings;
-const { pathname } = Astro.url;
-const { get_started } = await getTranslations(lang as keyof ContentEntryMap);
-
-const disabledLanguages = config.settings.disable_languages as string[];
-if (disabledLanguages.includes(lang)) {
- lang = default_language;
+export interface ChildNavigationLink {
+ name: string;
+ url: string;
}
+
+export interface NavigationLink {
+ name: string;
+ url: string;
+ hasChildren?: boolean;
+ children?: ChildNavigationLink[];
+}
+
+const { main }: { main: NavigationLink[] } = menu;
+const { navigation_button, settings } = config;
+const { pathname } = Astro.url;
---
- )
+ ),
)}
diff --git a/src/lib/contentParser.astro b/src/lib/contentParser.astro
index 048b5d3..a6d1013 100644
--- a/src/lib/contentParser.astro
+++ b/src/lib/contentParser.astro
@@ -3,132 +3,14 @@ import {
getCollection,
type CollectionEntry,
type CollectionKey,
- type ContentEntryMap,
} from "astro:content";
-import config from "@/config/config.json";
-import languages from "@/config/language.json";
-
-export const getSP = async (
- collectionName: C,
- lang: keyof ContentEntryMap | undefined
-): Promise[]> => {
- const { default_language } = config.settings;
-
- const selectedLanguageCode = lang || default_language;
-
- const language = languages.find(
- (l: any) => l.languageCode === selectedLanguageCode
- );
-
- if (!language) {
- throw new Error("Language not found");
- }
-
- const { contentDir } = language;
-
- const pages: CollectionEntry[] = (await getCollection(
- contentDir as any,
- ({ id }: any) => {
- return id.startsWith(collectionName) && !id.endsWith("-index.md");
- }
- )) as CollectionEntry[];
-
- // @ts-ignore
- const removeDrafts = pages.filter((data) => !data.data.draft);
-
- return removeDrafts;
-};
-
-export const getLP = async (
- collectionName: C,
- lang: keyof ContentEntryMap | undefined
-): Promise[]> => {
- const { default_language } = config.settings;
-
- const selectedLanguageCode = lang || default_language;
-
- const language = languages.find(
- (l: any) => l.languageCode == selectedLanguageCode
- );
-
- if (!language) {
- throw new Error("Language not found");
- }
-
- const { contentDir } = language;
-
- const pages: CollectionEntry[] = (await getCollection(
- contentDir as any,
- ({ id }: any) => {
- return id.startsWith(collectionName);
- }
- )) as CollectionEntry[];
-
- return pages;
-};
-
export const getSinglePage = async (
collectionName: C,
- lang: keyof ContentEntryMap | undefined,
- subCollectionName?: string
): Promise[]> => {
- const { default_language } = config.settings;
-
- const selectedLanguageCode = lang || default_language;
-
- const language = languages.find(
- (l: any) => l.languageCode === selectedLanguageCode
- );
-
- if (!language) {
- throw new Error("Language not found");
- }
-
- const { contentDir } = language;
-
- const path = subCollectionName
- ? `${contentDir}/${subCollectionName}`
- : contentDir;
-
- const pages: CollectionEntry[] = (await getCollection(
- collectionName as any,
- ({ id }: any) => {
- return id.startsWith(path) && !id.endsWith("-index.md");
- }
- )) as CollectionEntry[];
-
- // @ts-ignore
- const removeDrafts = pages.filter((data) => !data.data.draft);
-
+ const allPages = await getCollection(collectionName);
+ const removeIndex = allPages.filter((data) => data.id.match(/^(?!-)/));
+ const removeDrafts = removeIndex.filter((data) => !data.data.draft);
return removeDrafts;
};
-
-export const getListPage = async (
- collectionName: C,
- lang: keyof ContentEntryMap | undefined
-): Promise[]> => {
- const { default_language } = config.settings;
-
- const selectedLanguageCode = lang || default_language;
-
- const language = languages.find(
- (l: any) => l.languageCode == selectedLanguageCode
- );
-
- if (!language) {
- throw new Error("Language not found");
- }
-
- const { contentDir } = language;
-
- const pages: CollectionEntry[] = (await getCollection(
- collectionName as any,
- ({ id }: any) => {
- return id.startsWith(contentDir);
- }
- )) as CollectionEntry[];
-
- return pages;
-};
---
diff --git a/src/lib/taxonomyParser.astro b/src/lib/taxonomyParser.astro
index ad38fb0..56d50db 100644
--- a/src/lib/taxonomyParser.astro
+++ b/src/lib/taxonomyParser.astro
@@ -1,34 +1,10 @@
---
-import config from "@/config/config.json";
-import languages from "@/config/language.json";
+import { getSinglePage } from "@/lib/contentParser.astro";
import { slugify } from "@/lib/utils/textConverter";
-import type { ContentEntryMap } from "astro:content";
-import { getCollection } from "astro:content";
// get taxonomy from frontmatter
-export const getTaxonomy = async (collection: string, name: string) => {
- const { default_language } = config.settings;
-
- const language = languages.find((l) => l.languageCode === collection);
-
- let actualCollection = default_language;
- if (language) {
- actualCollection = language.contentDir;
- } else {
- const defaultLanguageMatch = languages.find(
- (l) => l.languageCode === default_language
- );
- if (defaultLanguageMatch) {
- actualCollection = defaultLanguageMatch.contentDir;
- }
- }
-
- const singlePages = await getCollection(
- "blog" as keyof ContentEntryMap,
- ({ id }: any) => {
- return id.startsWith(actualCollection) && !id.endsWith("-index.md");
- }
- );
+export const getTaxonomy = async (collection: any, name: string) => {
+ const singlePages = await getSinglePage(collection);
const taxonomyPages = singlePages.map((page: any) => page.data[name]);
let taxonomies: string[] = [];
for (let i = 0; i < taxonomyPages.length; i++) {
@@ -42,29 +18,8 @@ export const getTaxonomy = async (collection: string, name: string) => {
};
// get all taxonomies from frontmatter
-export const getAllTaxonomy = async (collection: string, name: string) => {
- const { default_language } = config.settings;
-
- const language = languages.find((l) => l.languageCode === collection);
-
- let actualCollection = default_language;
- if (language) {
- actualCollection = language.contentDir;
- } else {
- const defaultLanguageMatch = languages.find(
- (l) => l.languageCode === default_language
- );
- if (defaultLanguageMatch) {
- actualCollection = defaultLanguageMatch.contentDir;
- }
- }
-
- const singlePages = await getCollection(
- "blog" as keyof ContentEntryMap,
- ({ id }: any) => {
- return id.startsWith(actualCollection) && !id.endsWith("-index.md");
- }
- );
+export const getAllTaxonomy = async (collection: any, name: string) => {
+ const singlePages = await getSinglePage(collection);
const taxonomyPages = singlePages.map((page: any) => page.data[name]);
let taxonomies: string[] = [];
for (let i = 0; i < taxonomyPages.length; i++) {
diff --git a/src/lib/utils/languageParser.ts b/src/lib/utils/languageParser.ts
deleted file mode 100644
index db2308a..0000000
--- a/src/lib/utils/languageParser.ts
+++ /dev/null
@@ -1,110 +0,0 @@
-import { getRelativeLocaleUrl } from "astro:i18n";
-import config from "../../config/config.json";
-import languagesJSON from "../../config/language.json";
-const { default_language } = config.settings;
-
-const locales: { [key: string]: any } = {};
-
-// Load menu and dictionary dynamically
-languagesJSON.forEach((language) => {
- const { languageCode } = language;
- import(`../../config/menu.${languageCode}.json`).then((menu) => {
- import(`../../i18n/${languageCode}.json`).then((dictionary) => {
- locales[languageCode] = { ...menu, ...dictionary };
- });
- });
-});
-
-// Extract all languages from the locales object
-const languages = Object.keys(locales);
-
-// Export the locales and languages
-export { languages, locales };
-
-export function getLangFromUrl(url: URL): string {
- const [, lang] = url.pathname.split("/");
- if (locales.hasOwnProperty(lang)) {
- return lang;
- }
- return default_language;
-}
-
-export const getTranslations = async (lang: string) => {
- const {
- default_language,
- disable_languages,
- }: { default_language: string; disable_languages: string[] } =
- config.settings;
-
- if (disable_languages.includes(lang)) {
- lang = default_language;
- }
-
- let language = languagesJSON.find((l) => l.languageCode === lang);
-
- if (!language) {
- lang = default_language;
- language = languagesJSON.find((l) => l.languageCode === default_language);
- }
-
- if (!language) {
- throw new Error("Default language not found");
- }
-
- const contentDir = language.contentDir;
-
- let menu, dictionary;
- try {
- menu = await import(`../../config/menu.${lang}.json`);
- dictionary = await import(`../../i18n/${lang}.json`);
- } catch (error) {
- menu = await import(`../../config/menu.${default_language}.json`);
- dictionary = await import(`../../i18n/${default_language}.json`);
- }
-
- return { ...menu.default, ...dictionary.default, contentDir };
-};
-
-const supportedLang = ["", ...languagesJSON.map((lang) => lang.languageCode)];
-const disabledLanguages = config.settings.disable_languages as string[];
-
-// Filter out disabled languages from supportedLang
-const filteredSupportedLang = supportedLang.filter(
- (lang) => !disabledLanguages.includes(lang),
-);
-
-export { filteredSupportedLang as supportedLang };
-
-export const slugSelector = (url: string, lang: string) => {
- const { default_language, default_language_in_subdir } = config.settings;
- const { trailing_slash } = config.site;
-
- let constructedUrl;
-
- // Determine the initial URL structure based on language
- if (url === "/") {
- constructedUrl = lang === default_language ? "/" : `/${lang}`;
- } else {
- constructedUrl = getRelativeLocaleUrl(lang, url, {
- normalizeLocale: false,
- });
- }
-
- // Add language path if necessary
- if (lang === default_language && default_language_in_subdir) {
- constructedUrl = `/${lang}${constructedUrl}`;
- }
-
- // Adjust for trailing slash
- if (trailing_slash) {
- if (!constructedUrl.endsWith("/")) {
- constructedUrl += "/";
- }
- } else {
- if (constructedUrl.endsWith("/") && constructedUrl !== "/") {
- constructedUrl = constructedUrl.slice(0, -1);
- }
- }
-
- return constructedUrl;
-};
diff --git a/src/pages/404.astro b/src/pages/404.astro
index 18f83dd..6f492bd 100755
--- a/src/pages/404.astro
+++ b/src/pages/404.astro
@@ -1,30 +1,5 @@
---
-import config from "@/config/config.json";
import Base from "@/layouts/Base.astro";
-import {
- getLangFromUrl,
- getTranslations,
- supportedLang,
- slugSelector,
-} from "@/lib/utils/languageParser";
-import type { ContentEntryMap } from "astro:content";
-
-export function getStaticPaths() {
- const paths = supportedLang.map((lang) => ({
- params: { lang: lang || undefined },
- }));
- return paths;
-}
-
-let lang = getLangFromUrl(Astro.url);
-
-const disabledLanguages = config.settings.disable_languages as string[];
-if (disabledLanguages.includes(lang)) {
- lang = config.settings.default_language;
-}
-
-const { page_not_found_content, page_not_found, back_to_home } =
- await getTranslations(lang as keyof ContentEntryMap);
---
@@ -37,13 +12,14 @@ const { page_not_found_content, page_not_found, back_to_home } =
>
404
- {page_not_found}
+ Page not found
-
{page_not_found_content}
+
+ The page you are looking for might have been removed, had its name
+ changed, or is temporarily unavailable.
+
- {back_to_home}
+ Back to home
diff --git a/src/pages/[...lang]/authors/index.astro b/src/pages/[...lang]/authors/index.astro
deleted file mode 100755
index e0f1e8d..0000000
--- a/src/pages/[...lang]/authors/index.astro
+++ /dev/null
@@ -1,44 +0,0 @@
----
-import AuthorCard from "@/components/AuthorCard.astro";
-import Base from "@/layouts/Base.astro";
-import { getListPage, getSinglePage } from "@/lib/contentParser.astro";
-import { supportedLang } from "@/lib/utils/languageParser";
-import PageHeader from "@/partials/PageHeader.astro";
-import { type ContentEntryMap } from "astro:content";
-
-const COLLECTION_FOLDER = "authors";
-
-export function getStaticPaths() {
- const paths = supportedLang.map((lang) => ({
- params: { lang: lang || undefined },
- }));
- return paths;
-}
-
-const { lang } = Astro.params;
-const authorIndex = await getListPage(
- COLLECTION_FOLDER,
- lang as keyof ContentEntryMap
-);
-const authors = await getSinglePage(
- COLLECTION_FOLDER,
- lang as keyof ContentEntryMap
-);
----
-
-
-
-
-
-
- {
- authors.map((author) => (
-
- ))
- }
-
-
-
-
diff --git a/src/pages/[...lang]/blog/[single].astro b/src/pages/[...lang]/blog/[single].astro
deleted file mode 100755
index 8cfa906..0000000
--- a/src/pages/[...lang]/blog/[single].astro
+++ /dev/null
@@ -1,43 +0,0 @@
----
-import Base from "@/layouts/Base.astro";
-import PostSingle from "@/layouts/PostSingle.astro";
-import { getSinglePage } from "@/lib/contentParser.astro";
-import { supportedLang } from "@/lib/utils/languageParser";
-import type { ContentEntryMap } from "astro:content";
-
-export async function getStaticPaths() {
- const BLOG_FOLDER = "blog";
-
- const paths = await Promise.all(
- supportedLang.map(async (lang) => {
- const posts = await getSinglePage(
- BLOG_FOLDER,
- lang as keyof ContentEntryMap
- );
-
- return posts.map((post) => ({
- params: {
- lang: lang || undefined,
- single: post.slug.split("/").pop(),
- },
- props: {
- post,
- },
- }));
- })
- );
- return paths.flat();
-}
-
-const { post } = Astro.props;
-const { title, meta_title, description, image } = post.data;
----
-
-
-
-
diff --git a/src/pages/[...lang]/categories/[category].astro b/src/pages/[...lang]/categories/[category].astro
deleted file mode 100755
index bf92733..0000000
--- a/src/pages/[...lang]/categories/[category].astro
+++ /dev/null
@@ -1,78 +0,0 @@
----
-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/languageParser";
-import { sortByDate } from "@/lib/utils/sortFunctions";
-import taxonomyFilter from "@/lib/utils/taxonomyFilter";
-import PageHeader from "@/partials/PageHeader.astro";
-import type { ContentEntryMap } from "astro:content";
-
-// get all static paths for categories
-export async function getStaticPaths() {
- const { default_language } = config.settings;
-
- const paths = await Promise.all(
- supportedLang.map(async (lang) => {
- const categories = await getTaxonomy(
- lang as keyof ContentEntryMap,
- "categories"
- );
-
- return categories.map((category) => ({
- params: {
- lang: lang || undefined,
- category: category,
- },
- props: {
- category,
- },
- }));
- })
- );
-
- // Handle default path (no lang)
- const defaultCategories = await getTaxonomy(
- default_language as keyof ContentEntryMap,
- "categories"
- );
- const defaultPaths = defaultCategories.map((category) => ({
- params: {
- lang: undefined,
- category: category,
- },
- props: {
- category,
- },
- }));
-
- return [...paths.flat(), ...defaultPaths];
-}
-
-const { category, lang } = Astro.params;
-
-// get posts by category
-const BLOG_FOLDER = "blog";
-const posts = await getSinglePage(BLOG_FOLDER, lang as keyof ContentEntryMap);
-const filterByCategories = taxonomyFilter(posts, "categories", category!);
-const sortedPosts = sortByDate(filterByCategories);
----
-
-
-
-
-
-
- {
- sortedPosts.map((post) => (
-
-
-
- ))
- }
-
-
-
-
diff --git a/src/pages/[...lang]/tags/[tag].astro b/src/pages/[...lang]/tags/[tag].astro
deleted file mode 100644
index ab84299..0000000
--- a/src/pages/[...lang]/tags/[tag].astro
+++ /dev/null
@@ -1,75 +0,0 @@
----
-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/languageParser";
-import { sortByDate } from "@/lib/utils/sortFunctions";
-import taxonomyFilter from "@/lib/utils/taxonomyFilter";
-import PageHeader from "@/partials/PageHeader.astro";
-import type { ContentEntryMap } from "astro:content";
-
-// get all static paths for tags
-export async function getStaticPaths() {
- const { default_language } = config.settings;
-
- const paths = await Promise.all(
- supportedLang.map(async (lang) => {
- const tags = await getTaxonomy(lang as keyof ContentEntryMap, "tags");
-
- return tags.map((tag) => ({
- params: {
- lang: lang || undefined,
- tag: tag,
- },
- props: {
- tag,
- },
- }));
- })
- );
-
- // Handle default path (no lang)
- const defaultCategories = await getTaxonomy(
- default_language as keyof ContentEntryMap,
- "tags"
- );
- const defaultPaths = defaultCategories.map((tag) => ({
- params: {
- lang: undefined,
- tag: tag,
- },
- props: {
- tag,
- },
- }));
-
- return [...paths.flat(), ...defaultPaths];
-}
-
-const { tag, lang } = Astro.params;
-
-// get posts by tag
-const BLOG_FOLDER = "blog";
-const posts = await getSinglePage(BLOG_FOLDER, lang as keyof ContentEntryMap);
-const filterByTags = taxonomyFilter(posts, "tags", tag!);
-const sortedPosts = sortByDate(filterByTags);
----
-
-
-
-
-
-
- {
- sortedPosts.map((post) => (
-
-
-
- ))
- }
-
-
-
-
diff --git a/src/pages/[...lang]/[regular].astro b/src/pages/[regular].astro
similarity index 58%
rename from src/pages/[...lang]/[regular].astro
rename to src/pages/[regular].astro
index cc08640..9990e6a 100755
--- a/src/pages/[...lang]/[regular].astro
+++ b/src/pages/[regular].astro
@@ -1,27 +1,21 @@
---
import Base from "@/layouts/Base.astro";
import { getSinglePage } from "@/lib/contentParser.astro";
-import { supportedLang } from "@/lib/utils/languageParser";
import PageHeader from "@/partials/PageHeader.astro";
-import type { ContentEntryMap } from "astro:content";
+// get static paths for all pages
export async function getStaticPaths() {
- const paths = await Promise.all(
- supportedLang.map(async (lang) => {
- const pages = await getSinglePage("pages", lang as keyof ContentEntryMap);
+ const COLLECTION_FOLDER = "pages";
- return pages.map((page) => ({
- params: {
- lang: lang || undefined,
- regular: page.slug.split("/").pop(),
- },
- props: {
- page,
- },
- }));
- })
- );
- return paths.flat();
+ const pages = await getSinglePage(COLLECTION_FOLDER);
+
+ const paths = pages.map((page) => ({
+ params: {
+ regular: page.slug,
+ },
+ props: { page },
+ }));
+ return paths;
}
const { page } = Astro.props;
diff --git a/src/pages/[...lang]/about.astro b/src/pages/about.astro
similarity index 62%
rename from src/pages/[...lang]/about.astro
rename to src/pages/about.astro
index 9065501..064384d 100644
--- a/src/pages/[...lang]/about.astro
+++ b/src/pages/about.astro
@@ -1,23 +1,12 @@
---
import ImageMod from "@/components/ImageMod.astro";
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 { ContentEntryMap } from "astro:content";
+import { getEntry } from "astro:content";
-export function getStaticPaths() {
- 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 { Content } = await about[0].render();
-const { title, description, meta_title, image } = about[0].data;
+const about = await getEntry("about", "-index");
+const { Content } = await about.render();
+const { title, description, meta_title, image } = about.data;
---
{
- const authors = await getSinglePage(
- COLLECTION_FOLDER,
- lang as keyof ContentEntryMap
- );
-
- return authors.map((author) => ({
- params: {
- lang: lang || undefined,
- single: author.slug.split("/").pop(),
- },
- props: {
- author,
- lang,
- },
- }));
- })
- );
- return paths.flat();
+ const paths = authors.map((author) => ({
+ params: {
+ single: author.slug,
+ },
+ props: { author },
+ }));
+ return paths;
}
-const { author, lang } = Astro.props;
+const { author } = Astro.props;
const { title, social, meta_title, description, image } = author.data;
const { Content } = await author.render();
// get all posts by author
const BLOG_FOLDER = "blog";
-const posts = await getSinglePage(BLOG_FOLDER, lang as keyof ContentEntryMap);
+const posts = await getSinglePage(BLOG_FOLDER);
const postFilterByAuthor = posts.filter(
- (post) => slugify(post.data.author) === slugify(title)
+ (post) => slugify(post.data.author) === slugify(title),
);
---
diff --git a/src/pages/authors/index.astro b/src/pages/authors/index.astro
new file mode 100755
index 0000000..8df557f
--- /dev/null
+++ b/src/pages/authors/index.astro
@@ -0,0 +1,29 @@
+---
+import AuthorCard from "@/components/AuthorCard.astro";
+import Base from "@/layouts/Base.astro";
+import { getSinglePage } from "@/lib/contentParser.astro";
+import PageHeader from "@/partials/PageHeader.astro";
+import { getEntry } from "astro:content";
+
+const COLLECTION_FOLDER = "authors";
+
+const authorIndex = await getEntry(COLLECTION_FOLDER, "-index");
+const authors = await getSinglePage(COLLECTION_FOLDER);
+---
+
+
+
+
+
+
+ {
+ authors.map((author) => (
+
+ ))
+ }
+
+
+
+
diff --git a/src/pages/blog/[single].astro b/src/pages/blog/[single].astro
new file mode 100755
index 0000000..984477b
--- /dev/null
+++ b/src/pages/blog/[single].astro
@@ -0,0 +1,30 @@
+---
+import Base from "@/layouts/Base.astro";
+import PostSingle from "@/layouts/PostSingle.astro";
+import { getSinglePage } from "@/lib/contentParser.astro";
+
+export async function getStaticPaths() {
+ const BLOG_FOLDER = "blog";
+ const posts = await getSinglePage(BLOG_FOLDER);
+
+ const paths = posts.map((post) => ({
+ params: {
+ single: post.slug,
+ },
+ props: { post },
+ }));
+ return paths;
+}
+
+const { post } = Astro.props;
+const { title, meta_title, description, image } = post.data;
+---
+
+
+
+
diff --git a/src/pages/[...lang]/blog/index.astro b/src/pages/blog/index.astro
similarity index 58%
rename from src/pages/[...lang]/blog/index.astro
rename to src/pages/blog/index.astro
index c4f44a9..4a29c30 100755
--- a/src/pages/[...lang]/blog/index.astro
+++ b/src/pages/blog/index.astro
@@ -3,44 +3,32 @@ import BlogCard from "@/components/BlogCard.astro";
import Pagination from "@/components/Pagination.astro";
import config from "@/config/config.json";
import Base from "@/layouts/Base.astro";
-import { getListPage, getSinglePage } from "@/lib/contentParser.astro";
+import { getSinglePage } from "@/lib/contentParser.astro";
import { getAllTaxonomy, getTaxonomy } from "@/lib/taxonomyParser.astro";
-import { supportedLang } from "@/lib/utils/languageParser";
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 { getEntry } from "astro:content";
-export function getStaticPaths() {
- const paths = supportedLang.map((lang) => ({
- params: { lang: lang || undefined },
- }));
- return paths;
-}
-const { lang } = Astro.params;
const BLOG_FOLDER = "blog";
-const postIndex = await getListPage(
- BLOG_FOLDER,
- lang as keyof ContentEntryMap
-);
-const langCollection: keyof ContentEntryMap = lang as keyof ContentEntryMap;
-const posts = await getSinglePage(BLOG_FOLDER, lang as keyof ContentEntryMap);
-const allCategories = await getAllTaxonomy(langCollection, "categories");
-const categories = await getTaxonomy(langCollection, "categories");
-const tags = await getTaxonomy(langCollection, "tags");
+const postIndex = await getEntry(BLOG_FOLDER, "-index");
+const posts = await getSinglePage(BLOG_FOLDER);
+const allCategories = await getAllTaxonomy(BLOG_FOLDER, "categories");
+const categories = await getTaxonomy(BLOG_FOLDER, "categories");
+const tags = await getTaxonomy(BLOG_FOLDER, "tags");
const sortedPosts = sortByDate(posts);
const totalPages: number = Math.ceil(posts.length / config.settings.pagination);
const currentPosts = sortedPosts.slice(0, config.settings.pagination);
---
-
+
diff --git a/src/pages/[...lang]/blog/page/[slug].astro b/src/pages/blog/page/[slug].astro
similarity index 52%
rename from src/pages/[...lang]/blog/page/[slug].astro
rename to src/pages/blog/page/[slug].astro
index b72a8be..26b7e1e 100755
--- a/src/pages/[...lang]/blog/page/[slug].astro
+++ b/src/pages/blog/page/[slug].astro
@@ -3,36 +3,21 @@ import BlogCard from "@/components/BlogCard.astro";
import Pagination from "@/components/Pagination.astro";
import config from "@/config/config.json";
import Base from "@/layouts/Base.astro";
-import { getListPage, getSinglePage } from "@/lib/contentParser.astro";
+import { getSinglePage } from "@/lib/contentParser.astro";
import { getAllTaxonomy, getTaxonomy } from "@/lib/taxonomyParser.astro";
-import { supportedLang } from "@/lib/utils/languageParser";
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 { getEntry } from "astro:content";
+
const BLOG_FOLDER = "blog";
-const { default_language } = config.settings;
-let { slug, lang } = Astro.params;
-
-if (!lang) {
- lang = default_language;
-}
-
-const postIndex: any = await getListPage(
- BLOG_FOLDER,
- lang as keyof ContentEntryMap
-);
-const posts = await getSinglePage(BLOG_FOLDER, lang as keyof ContentEntryMap);
-const allCategories = await getAllTaxonomy(
- lang as keyof ContentEntryMap,
- "categories"
-);
-const categories = await getTaxonomy(
- lang as keyof ContentEntryMap,
- "categories"
-);
-const tags = await getTaxonomy(lang as keyof ContentEntryMap, "tags");
+const { slug } = Astro.params;
+const postIndex = await getEntry(BLOG_FOLDER, "-index");
+const posts = await getSinglePage(BLOG_FOLDER);
+const allCategories = await getAllTaxonomy(BLOG_FOLDER, "categories");
+const categories = await getTaxonomy(BLOG_FOLDER, "categories");
+const tags = await getTaxonomy(BLOG_FOLDER, "tags");
const sortedPosts = sortByDate(posts);
const totalPages = Math.ceil(posts.length / config.settings.pagination);
const currentPage = slug && !isNaN(Number(slug)) ? Number(slug) : 1;
@@ -42,41 +27,28 @@ const currentPosts = sortedPosts.slice(indexOfFirstPost, indexOfLastPost);
export async function getStaticPaths() {
const BLOG_FOLDER = "blog";
+ const posts = await getSinglePage(BLOG_FOLDER);
+ const totalPages = Math.ceil(posts.length / config.settings.pagination);
+ const paths = [];
- const paths = await Promise.all(
- supportedLang.map(async (lang) => {
- const posts = await getSinglePage(
- BLOG_FOLDER,
- lang as keyof ContentEntryMap
- );
- const totalPages = Math.ceil(posts.length / config.settings.pagination);
- const langString = lang.toString();
- const langPaths = [];
-
- for (let i = 1; i < totalPages; i++) {
- langPaths.push({
- params: {
- lang: langString || undefined,
- slug: (i + 1).toString(),
- },
- });
- }
-
- return langPaths;
- })
- );
-
- return paths.flat();
+ for (let i = 1; i < totalPages; i++) {
+ paths.push({
+ params: {
+ slug: (i + 1).toString(),
+ },
+ });
+ }
+ return paths;
}
---
-
+
diff --git a/src/pages/categories/[category].astro b/src/pages/categories/[category].astro
new file mode 100755
index 0000000..c5fbef9
--- /dev/null
+++ b/src/pages/categories/[category].astro
@@ -0,0 +1,46 @@
+---
+import BlogCard from "@/components/BlogCard.astro";
+import Base from "@/layouts/Base.astro";
+import { getSinglePage } from "@/lib/contentParser.astro";
+import { getTaxonomy } from "@/lib/taxonomyParser.astro";
+import { sortByDate } from "@/lib/utils/sortFunctions";
+import taxonomyFilter from "@/lib/utils/taxonomyFilter";
+import PageHeader from "@/partials/PageHeader.astro";
+
+// get static paths for all categories
+export async function getStaticPaths() {
+ const BLOG_FOLDER = "blog";
+ const categories = await getTaxonomy(BLOG_FOLDER, "categories");
+
+ return categories.map((category) => {
+ return {
+ params: { category },
+ };
+ });
+}
+
+const { category } = Astro.params;
+
+// get posts by category
+const BLOG_FOLDER = "blog";
+const posts = await getSinglePage(BLOG_FOLDER);
+const filterByCategories = taxonomyFilter(posts, "categories", category!);
+const sortedPosts = sortByDate(filterByCategories);
+---
+
+
+
+
+
+
+ {
+ sortedPosts.map((post) => (
+
+
+
+ ))
+ }
+
+
+
+
diff --git a/src/pages/[...lang]/categories/index.astro b/src/pages/categories/index.astro
similarity index 59%
rename from src/pages/[...lang]/categories/index.astro
rename to src/pages/categories/index.astro
index 3e336ec..eae7810 100755
--- a/src/pages/[...lang]/categories/index.astro
+++ b/src/pages/categories/index.astro
@@ -1,28 +1,13 @@
---
-import config from "@/config/config.json";
import Base from "@/layouts/Base.astro";
import { getAllTaxonomy, getTaxonomy } from "@/lib/taxonomyParser.astro";
-import { slugSelector, supportedLang } from "@/lib/utils/languageParser";
import { humanize } from "@/lib/utils/textConverter";
import PageHeader from "@/partials/PageHeader.astro";
-import type { ContentEntryMap } from "astro:content";
-const { default_language } = config.settings;
-export function getStaticPaths() {
- const paths = supportedLang.map((lang) => ({
- params: { lang: lang || undefined },
- }));
- return paths;
-}
+const BLOG_FOLDER = "blog";
-let { lang } = Astro.params;
-if (!lang) {
- lang = default_language;
-}
-
-const langCollection: keyof ContentEntryMap = lang as keyof ContentEntryMap;
-const categories = await getTaxonomy(langCollection, "categories");
-const allCategories = await getAllTaxonomy(langCollection, "categories");
+const categories = await getTaxonomy(BLOG_FOLDER, "categories");
+const allCategories = await getAllTaxonomy(BLOG_FOLDER, "categories");
---
@@ -36,7 +21,7 @@ const allCategories = await getAllTaxonomy(langCollection, "categories");
return (
{humanize(category)}{" "}
diff --git a/src/pages/[...lang]/contact.astro b/src/pages/contact.astro
similarity index 59%
rename from src/pages/[...lang]/contact.astro
rename to src/pages/contact.astro
index 9534843..56742a8 100644
--- a/src/pages/[...lang]/contact.astro
+++ b/src/pages/contact.astro
@@ -1,31 +1,12 @@
---
import config from "@/config/config.json";
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 ContentEntryMap } from "astro:content";
-
-export function getStaticPaths() {
- const paths = supportedLang.map((lang) => ({
- params: { lang: lang || undefined },
- }));
- return paths;
-}
-
-const { lang } = Astro.params;
-const contact = await getListPage("contact", lang as keyof ContentEntryMap);
+import { getEntry } from "astro:content";
+const contact = await getEntry("contact", "-index");
const { contact_form_action }: { contact_form_action: string } = config.params;
-const { title, description, meta_title, image } = contact[0].data;
-
-const {
- working_mail,
- full_name,
- anything_else,
- contact_message_placeholder,
- submit,
-} = await getTranslations(lang as keyof ContentEntryMap);
+const { title, description, meta_title, image } = contact.data;
---
diff --git a/src/pages/[...lang]/index.astro b/src/pages/index.astro
similarity index 75%
rename from src/pages/[...lang]/index.astro
rename to src/pages/index.astro
index a4aae5f..19d3f99 100755
--- a/src/pages/[...lang]/index.astro
+++ b/src/pages/index.astro
@@ -1,37 +1,27 @@
---
import ImageMod from "@/components/ImageMod.astro";
import Base from "@/layouts/Base.astro";
-import { getListPage, getSinglePage } from "@/lib/contentParser.astro";
-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 { Feature } from "@/types";
-import type { ContentEntryMap } from "astro:content";
+import type { Button, Feature } from "@/types";
+import { getEntry } from "astro:content";
import { FaCheck } from "react-icons/fa";
-export function getStaticPaths() {
- const paths = supportedLang.map((lang) => ({
- params: { lang: lang || undefined },
- }));
- return paths;
+interface Homepage {
+ banner: {
+ title: string;
+ content: string;
+ image: string;
+ button: Button;
+ };
+ features: Feature[];
}
-const { lang } = Astro.params;
-const homepage = await getListPage("homepage", lang as keyof ContentEntryMap);
-const { banner, features } = homepage[0].data;
-
-const testimonial = await getSinglePage(
- "sections",
- lang as keyof ContentEntryMap,
- "testimonial"
-);
-
-const call_to_action = await getSinglePage(
- "sections",
- lang as keyof ContentEntryMap,
- "call-to-action"
-);
+const homepage = await getEntry("homepage", "-index");
+const testimonial = await getEntry("sections", "testimonial");
+const call_to_action = await getEntry("sections", "call-to-action");
+const { banner, features }: Homepage = homepage.data;
---
@@ -80,7 +70,7 @@ const call_to_action = await getSinglePage(
{
- features.map((feature: Feature, index: number) => (
+ features.map((feature, index: number) => (
@@ -119,6 +109,6 @@ const call_to_action = await getSinglePage(
}
-
-
+
+
diff --git a/src/pages/tags/[tag].astro b/src/pages/tags/[tag].astro
new file mode 100755
index 0000000..cd81405
--- /dev/null
+++ b/src/pages/tags/[tag].astro
@@ -0,0 +1,45 @@
+---
+import BlogCard from "@/components/BlogCard.astro";
+import Base from "@/layouts/Base.astro";
+import { getSinglePage } from "@/lib/contentParser.astro";
+import { getTaxonomy } from "@/lib/taxonomyParser.astro";
+import { sortByDate } from "@/lib/utils/sortFunctions";
+import taxonomyFilter from "@/lib/utils/taxonomyFilter";
+import PageHeader from "@/partials/PageHeader.astro";
+
+export async function getStaticPaths() {
+ const BLOG_FOLDER = "blog";
+ const tags = await getTaxonomy(BLOG_FOLDER, "tags");
+
+ return tags.map((tag) => {
+ return {
+ params: { tag },
+ };
+ });
+}
+
+const { tag } = Astro.params;
+
+// get posts by tag
+const BLOG_FOLDER = "blog";
+const posts = await getSinglePage(BLOG_FOLDER);
+const filterByTags = taxonomyFilter(posts, "tags", tag!);
+const sortedPosts = sortByDate(filterByTags);
+---
+
+
+
+
+
+
+ {
+ sortedPosts.map((post) => (
+
+
+
+ ))
+ }
+
+
+
+
diff --git a/src/pages/[...lang]/tags/index.astro b/src/pages/tags/index.astro
old mode 100644
new mode 100755
similarity index 59%
rename from src/pages/[...lang]/tags/index.astro
rename to src/pages/tags/index.astro
index 68e8247..0989c16
--- a/src/pages/[...lang]/tags/index.astro
+++ b/src/pages/tags/index.astro
@@ -1,28 +1,13 @@
---
-import config from "@/config/config.json";
import Base from "@/layouts/Base.astro";
import { getAllTaxonomy, getTaxonomy } from "@/lib/taxonomyParser.astro";
-import { slugSelector, supportedLang } from "@/lib/utils/languageParser";
import { humanize } from "@/lib/utils/textConverter";
import PageHeader from "@/partials/PageHeader.astro";
-import type { ContentEntryMap } from "astro:content";
-const { default_language } = config.settings;
-export function getStaticPaths() {
- const paths = supportedLang.map((lang) => ({
- params: { lang: lang || undefined },
- }));
- return paths;
-}
+const BLOG_FOLDER = "blog";
-let { lang } = Astro.params;
-
-if (!lang) {
- lang = default_language;
-}
-const langCollection: keyof ContentEntryMap = lang as keyof ContentEntryMap;
-const tags = await getTaxonomy(langCollection, "tags");
-const allTags = await getAllTaxonomy(langCollection, "tags");
+const tags = await getTaxonomy(BLOG_FOLDER, "tags");
+const allTags = await getAllTaxonomy(BLOG_FOLDER, "tags");
---
@@ -36,7 +21,7 @@ const allTags = await getAllTaxonomy(langCollection, "tags");
return (
{humanize(tag)}{" "}
diff --git a/src/styles/main.scss b/src/styles/main.scss
index 9a3d421..1e27c0f 100755
--- a/src/styles/main.scss
+++ b/src/styles/main.scss
@@ -1,18 +1,19 @@
+@use "sass:meta";
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer base {
- @import "base";
+ @include meta.load-css("base");
}
@layer components {
- @import "components";
- @import "navigation";
- @import "buttons";
- @import "search";
+ @include meta.load-css("components");
+ @include meta.load-css("navigation");
+ @include meta.load-css("buttons");
+ @include meta.load-css("search");
}
@layer utilities {
- @import "utilities";
+ @include meta.load-css("utilities");
}
diff --git a/src/types/index.d.ts b/src/types/index.d.ts
index fb8ccc0..acb3d63 100644
--- a/src/types/index.d.ts
+++ b/src/types/index.d.ts
@@ -1,5 +1,3 @@
-import type { ContentEntryMap } from "astro:content";
-
export type Feature = {
button: button;
image: string;