From a334a67b039807576f23f3787d1d82ba7c2684f1 Mon Sep 17 00:00:00 2001 From: sergeyyarkov Date: Sat, 18 Feb 2023 18:53:19 +0300 Subject: [PATCH] recent articles render --- src/components/ArticlePost.astro | 7 ++-- src/components/Footer.astro | 17 ++++++---- src/components/RecentArticles.astro | 18 +++++----- ...»ΡŽΡ‡Π΅Π½ΠΈΠ΅-сдвигового-рСгистра-74hc595-ΠΊ-ΠΌΠΈΠΊΡ€ΠΎΠΊΠΎΡ‚Π½ΠΎΡ€ΠΎΠ»Π»Π΅Ρ€Ρƒ.md | 16 --------- src/i18n/en/ui.ts | 5 +-- src/i18n/ru/ui.ts | 5 +-- src/utils/article.ts | 33 +++++++++++++++++++ src/utils/index.ts | 2 ++ src/utils/string.ts | 10 ++++-- src/utils/url.ts | 4 +++ 10 files changed, 76 insertions(+), 41 deletions(-) delete mode 100644 src/content/blog/en/ΡƒΠΏΡ€Π°Π²Π»Π΅Π½ΠΈΠ΅-ΠΈ-ΠΏΠΎΠ΄ΠΊΠ»ΡŽΡ‡Π΅Π½ΠΈΠ΅-сдвигового-рСгистра-74hc595-ΠΊ-ΠΌΠΈΠΊΡ€ΠΎΠΊΠΎΡ‚Π½ΠΎΡ€ΠΎΠ»Π»Π΅Ρ€Ρƒ.md create mode 100644 src/utils/article.ts diff --git a/src/components/ArticlePost.astro b/src/components/ArticlePost.astro index 4671a61..b2fbbe2 100644 --- a/src/components/ArticlePost.astro +++ b/src/components/ArticlePost.astro @@ -5,14 +5,15 @@ import { createDateFormatter } from "@root/utils"; import ArticleCover from "@components/ArticleCover.astro"; import ArticleComments from "@components/ArticleComments.astro"; // import TranslatedLink from "../TranslatedLink"; -// import { useTranslation } from "@i18n/utils"; +import { useTranslation, getLanguageFromURL } from "@i18n/utils"; export type Props = { article: CollectionEntry<"blog">; lang: string; }; -const { article, lang } = Astro.props as Props; +const { article } = Astro.props as Props; +const pageLang = getLanguageFromURL(Astro.url.pathname); const canonicalUrl = new URL(Astro.url.pathname, Astro.site); const { data: { coverImage, title, author, description, tags, pubDate }, @@ -50,7 +51,7 @@ const {
diff --git a/src/components/Footer.astro b/src/components/Footer.astro index e30c9aa..1bb8b2a 100644 --- a/src/components/Footer.astro +++ b/src/components/Footer.astro @@ -3,19 +3,20 @@ import { SITE_METADATA } from "@root/constants"; import { Icon } from "astro-icon"; import TranslatedLink from "./TranslatedLink.astro"; import UIString from "./UIString.astro"; -const date = new Date(); ---