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 - - + 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;