diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/components/PostElement.astro | 6 | ||||
-rw-r--r-- | src/components/Sections/LatestPosts.astro | 6 | ||||
-rw-r--r-- | src/content/blog/create-lib-file-from-dll.md | 5 | ||||
-rw-r--r-- | src/content/blog/electron-reload.md | 5 | ||||
-rw-r--r-- | src/content/blog/example-content.md | 5 | ||||
-rw-r--r-- | src/content/blog/getting-source-code-of-chromium.md | 5 | ||||
-rw-r--r-- | src/content/blog/installing-moodle-to-fedora.md | 5 | ||||
-rw-r--r-- | src/content/blog/rust-and-tl-mr3020.md | 5 | ||||
-rw-r--r-- | src/content/config.ts | 5 | ||||
-rw-r--r-- | src/pages/404.astro | 1 | ||||
-rw-r--r-- | src/pages/blog/[...slug].astro | 13 | ||||
-rw-r--r-- | src/pages/blog/index.astro | 4 | ||||
-rw-r--r-- | src/pages/index.astro | 1 | ||||
-rw-r--r-- | src/utils/schemas/blogPostSchema.ts | 15 | ||||
-rw-r--r-- | src/utils/schemas/blogSchema.ts | 2 | ||||
-rw-r--r-- | src/utils/schemas/websiteSchema.ts | 4 |
16 files changed, 52 insertions, 35 deletions
diff --git a/src/components/PostElement.astro b/src/components/PostElement.astro index 85320ee..8b4b7c4 100644 --- a/src/components/PostElement.astro +++ b/src/components/PostElement.astro @@ -8,7 +8,9 @@ type Props = { const { post } = Astro.props; const { remarkPluginFrontmatter } = await post.render(); -const formattedDate = dayjs(post.data.pubDate.toString()).format("MMMM DD, YYYY"); + +const formattedDate = dayjs(post.data.datePublished.toString()).format("MMMM DD, YYYY"); +const datePublished = post.data.datePublished.toISOString(); --- <style lang="scss"> @@ -29,7 +31,7 @@ const formattedDate = dayjs(post.data.pubDate.toString()).format("MMMM DD, YYYY" <a href={`/blog/${post.slug}`} lang={post.data.lang}>{post.data.title}</a> <div> <small> - <time datetime={post.data.pubDate.toISOString()} lang="en">{formattedDate}</time> + <time datetime={datePublished} lang="en">{formattedDate}</time> <span>•</span> <span>{remarkPluginFrontmatter.minutesRead}</span> </small> diff --git a/src/components/Sections/LatestPosts.astro b/src/components/Sections/LatestPosts.astro index e91cb4c..e514ff5 100644 --- a/src/components/Sections/LatestPosts.astro +++ b/src/components/Sections/LatestPosts.astro @@ -7,7 +7,7 @@ const posts = await getCollection("blog", ({ data }) => { return data.draft !== true; }); -posts.sort((a, b) => b.data.pubDate.getTime() - a.data.pubDate.getTime()); +posts.sort((a, b) => b.data.datePublished.getTime() - a.data.datePublished.getTime()); const latestPosts = posts.slice(0, 5); --- @@ -32,8 +32,8 @@ const latestPosts = posts.slice(0, 5); </a> <small> - <time datetime={post.data.pubDate.toISOString()} lang="en"> - {dayjs(post.data.pubDate.toString()).format("MMMM DD, YYYY")} + <time datetime={post.data.datePublished.toISOString()} lang="en"> + {dayjs(post.data.datePublished.toString()).format("MMMM DD, YYYY")} </time> </small> </li> diff --git a/src/content/blog/create-lib-file-from-dll.md b/src/content/blog/create-lib-file-from-dll.md index 78d8e63..472ae23 100644 --- a/src/content/blog/create-lib-file-from-dll.md +++ b/src/content/blog/create-lib-file-from-dll.md @@ -1,8 +1,9 @@ --- title: 'Create ".lib" file from ".dll" (archive)' -author: "Adrian Henke" -pubDate: "2023-05-04" description: "Learn how to generate a *.lib file from a *.dll with this comprehensive guide. Using the Visual Studio Command Prompt and Microsoft's recommended tools, this article walks you through the steps for a seamless process. Perfect for developers working with 3rd party win dll's." +datePublished: "2023-05-04" +dateModified: "2023-05-04" +author: "Adrian Henke" lang: "en" --- diff --git a/src/content/blog/electron-reload.md b/src/content/blog/electron-reload.md index 8470d95..804f673 100644 --- a/src/content/blog/electron-reload.md +++ b/src/content/blog/electron-reload.md @@ -1,8 +1,9 @@ --- title: "Горячая перезагрузка ElectronJS приложения" -author: "Valentin Popov" -pubDate: "2019-08-15" description: "Руководство по автоматической перезагрузке приложений на Electron с помощью пакетов electron-reload и electron-webpack. Обход проблем с совместимостью и использование HMR для renderer процесса." +datePublished: "2019-08-15" +dateModified: "2019-08-15" +author: "Valentin Popov" lang: "ru" --- diff --git a/src/content/blog/example-content.md b/src/content/blog/example-content.md index 1d54603..f6d61b0 100644 --- a/src/content/blog/example-content.md +++ b/src/content/blog/example-content.md @@ -1,8 +1,9 @@ --- title: "Example Content" -author: "Example User" -pubDate: "2018-01-01" description: "Howdy! This is an example blog post that shows several types of HTML content supported in this theme." +datePublished: "2018-01-01" +dateModified: "2018-01-01" +author: "Example User" lang: "en" draft: true --- diff --git a/src/content/blog/getting-source-code-of-chromium.md b/src/content/blog/getting-source-code-of-chromium.md index b08c7a7..a47cbf4 100644 --- a/src/content/blog/getting-source-code-of-chromium.md +++ b/src/content/blog/getting-source-code-of-chromium.md @@ -1,8 +1,9 @@ --- title: 'Получение исходного кода "Chromium Projects"' -author: "Valentin Popov" -pubDate: "2012-01-30" description: "Изучение исходных кодов Chromium: подготовка системы и установка необходимых программных компонентов. Руководство для начинающих разработчиков. Получите инструкции по установке Microsoft Visual Studio, Cygwin, Python и других инструментов. Действительно на январь-февраль 2012 года." +datePublished: "2012-01-30" +dateModified: "2012-01-30" +author: "Valentin Popov" lang: "ru" --- diff --git a/src/content/blog/installing-moodle-to-fedora.md b/src/content/blog/installing-moodle-to-fedora.md index c7b4de0..2784641 100644 --- a/src/content/blog/installing-moodle-to-fedora.md +++ b/src/content/blog/installing-moodle-to-fedora.md @@ -1,8 +1,9 @@ --- title: "Установка Moodle в Fedora" -author: "Valentin Popov" -pubDate: "2018-07-23" description: "Решение проблем установки Moodle из-за SELinux: как настроить правила доступа для устранения ошибок в веб-интерфейсе и при работе с cURL. Практические советы и команды." +datePublished: "2018-07-23" +dateModified: "2018-07-23" +author: "Valentin Popov" lang: "ru" --- diff --git a/src/content/blog/rust-and-tl-mr3020.md b/src/content/blog/rust-and-tl-mr3020.md index 54d0d69..8479609 100644 --- a/src/content/blog/rust-and-tl-mr3020.md +++ b/src/content/blog/rust-and-tl-mr3020.md @@ -1,8 +1,9 @@ --- title: "Компиляция Rust на TL-MR3020" -author: "Valentin Popov" -pubDate: "2023-05-01" description: 'Как настроить и оптимизировать проект Rust для кросс-компиляции на TP-Link TL-MR3020 с использованием Fedora Linux 38 и OpenWrt 22.03.4. Шаг за шагом от базового "Hello, World!" до асинхронного TCP сервера.' +datePublished: "2023-05-01" +dateModified: "2023-05-01" +author: "Valentin Popov" lang: "ru" --- diff --git a/src/content/config.ts b/src/content/config.ts index 3467bda..d7f5f86 100644 --- a/src/content/config.ts +++ b/src/content/config.ts @@ -4,11 +4,12 @@ const blog = defineCollection({ type: "content", schema: z.object({ author: z.string(), + dateModified: z.coerce.date(), + datePublished: z.coerce.date(), description: z.string(), draft: z.optional(z.boolean()), - pubDate: z.coerce.date(), - title: z.string(), lang: z.string(), + title: z.string(), }), }); diff --git a/src/pages/404.astro b/src/pages/404.astro index 4215a60..072c6e7 100644 --- a/src/pages/404.astro +++ b/src/pages/404.astro @@ -9,6 +9,7 @@ const lang = "en"; const schema = websiteSchema({ siteUrl: new URL("/", Astro.site).toString(), title, + description, }); --- diff --git a/src/pages/blog/[...slug].astro b/src/pages/blog/[...slug].astro index 3cfdf31..deb98ac 100644 --- a/src/pages/blog/[...slug].astro +++ b/src/pages/blog/[...slug].astro @@ -27,15 +27,18 @@ const description = post.data.description; const author = post.data.author; const lang = post.data.lang; -const formattedData = dayjs(post.data.pubDate.toString()).format("MMMM DD, YYYY"); -const data = post.data.pubDate.toISOString(); +const formattedDate = dayjs(post.data.datePublished.toString()).format("MMMM DD, YYYY"); +const datePublished = post.data.datePublished.toISOString(); +const dateModified = post.data.dateModified?.toISOString(); +const slug = post.slug; const schema = blogPostSchema({ siteUrl: new URL("/", Astro.site).toString(), title, description, - slug: post.slug, - datePublished: data, + slug, + datePublished, + dateModified, author, lang, }); @@ -57,7 +60,7 @@ const schema = blogPostSchema({ <p> <small> Posted - <time datetime={data} lang="en">{formattedData}</time> + <time datetime={datePublished} lang="en">{formattedDate}</time> by {author} <span> • </span> <span>{remarkPluginFrontmatter.minutesRead}</span> diff --git a/src/pages/blog/index.astro b/src/pages/blog/index.astro index fd8b376..de5a0a9 100644 --- a/src/pages/blog/index.astro +++ b/src/pages/blog/index.astro @@ -10,10 +10,10 @@ const posts = await getCollection("blog", ({ data }) => { return data.draft !== true; }); -posts.sort((a, b) => b.data.pubDate.getTime() - a.data.pubDate.getTime()); +posts.sort((a, b) => b.data.datePublished.getTime() - a.data.datePublished.getTime()); const postsByYear = posts.reduce<Record<string, CollectionEntry<"blog">[]>>((acc, post) => { - const year = post.data.pubDate.getFullYear().toString(); + const year = post.data.datePublished.getFullYear().toString(); if (!acc[year]) { acc[year] = []; } diff --git a/src/pages/index.astro b/src/pages/index.astro index fb52e79..eaa5298 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -12,6 +12,7 @@ const lang = "en"; const schema = websiteSchema({ siteUrl: new URL("/", Astro.site).toString(), title, + description, }); --- diff --git a/src/utils/schemas/blogPostSchema.ts b/src/utils/schemas/blogPostSchema.ts index 5393cb1..00395dd 100644 --- a/src/utils/schemas/blogPostSchema.ts +++ b/src/utils/schemas/blogPostSchema.ts @@ -1,23 +1,24 @@ import type { WithContext, BlogPosting } from "schema-dts"; export type BlogPostSchemaParams = { - readonly siteUrl: string; - readonly title: string; - readonly description: string; - readonly slug: string; - readonly datePublished: string; readonly author: string; + readonly dateModified: string; + readonly datePublished: string; + readonly description: string; readonly lang: string; + readonly siteUrl: string; + readonly slug: string; + readonly title: string; }; -export default ({ siteUrl, title, description, slug, datePublished, author, lang }: BlogPostSchemaParams): WithContext<BlogPosting> => ({ +export default ({ siteUrl, slug, title, description, datePublished, dateModified, author, lang }: BlogPostSchemaParams): WithContext<BlogPosting> => ({ "@context": "https://schema.org", "@type": "BlogPosting", "url": new URL(`/blog/${slug}`, siteUrl).toString(), "headline": title, "description": description, "datePublished": datePublished, - "dateModified": datePublished, + "dateModified": dateModified, "inLanguage": lang, "author": { "@type": "Person", diff --git a/src/utils/schemas/blogSchema.ts b/src/utils/schemas/blogSchema.ts index 54e2fca..66a9bae 100644 --- a/src/utils/schemas/blogSchema.ts +++ b/src/utils/schemas/blogSchema.ts @@ -2,9 +2,9 @@ import type { WithContext, CollectionPage } from "schema-dts"; import type { CollectionEntry } from "astro:content"; export type BlogSchemaParams = { + readonly posts: CollectionEntry<"blog">[]; readonly siteUrl: string; readonly title: string; - readonly posts: CollectionEntry<"blog">[]; }; export default ({ siteUrl, title, posts }: BlogSchemaParams): WithContext<CollectionPage> => ({ diff --git a/src/utils/schemas/websiteSchema.ts b/src/utils/schemas/websiteSchema.ts index bebb963..b971e5e 100644 --- a/src/utils/schemas/websiteSchema.ts +++ b/src/utils/schemas/websiteSchema.ts @@ -1,13 +1,15 @@ import type { WithContext, WebSite } from "schema-dts"; export type WebsiteSchemaParams = { + readonly description: string; readonly siteUrl: string; readonly title: string; }; -export default ({ siteUrl, title }: WebsiteSchemaParams): WithContext<WebSite> => ({ +export default ({ siteUrl, title, description }: WebsiteSchemaParams): WithContext<WebSite> => ({ "@context": "https://schema.org", "@type": "WebSite", "url": new URL("/", siteUrl).toString(), "name": title, + "description": description, }); |