modified: app/posts/page.tsx

modified:   components/navigation-bar.tsx
	modified:   config/index.js
	modified:   config/types.ts
	modified:   contentlayer.config.ts
	modified:   public/sitemap-0.xml
main
joker 2 years ago
parent 0e8a2ea64f
commit c7e227a0cc
  1. 2
      app/posts/page.tsx
  2. 2
      components/navigation-bar.tsx
  3. 10
      config/index.js
  4. 18
      config/types.ts
  5. 39
      contentlayer.config.ts
  6. 12
      public/sitemap-0.xml

@ -1,5 +1,5 @@
import { type Metadata } from 'next/types'; import { type Metadata } from 'next/types';
import { allPosts } from 'contentlayer/generated'; import { allPosts, allInformatics } from 'contentlayer/generated';
import { compareDesc } from 'date-fns'; import { compareDesc } from 'date-fns';
import { blogConfig } from '@/config'; import { blogConfig } from '@/config';

@ -23,7 +23,7 @@ export function NavigationBar({ className }: NavigationBarProps) {
href="/posts" href="/posts"
className="font-semibold hover:text-accent dark:hover:text-accent-dark" className="font-semibold hover:text-accent dark:hover:text-accent-dark"
> >
Статьи Все статьи
</Link> </Link>
{allPages.map((page) => ( {allPages.map((page) => (
<Link <Link

@ -23,6 +23,12 @@ const blogConfig = {
description: description:
"Все мои записи в блоге. Я пишу о робототехнике и других темах, которые меня интересуют", "Все мои записи в блоге. Я пишу о робототехнике и других темах, которые меня интересуют",
}, },
informatics: {
url: '/posts/informatics',
title: 'Posts',
description:
"Все мои записи в блоге. Я пишу о робототехнике и других темах, которые меня интересуют",
},
}, },
theme: { theme: {
accentColor: { accentColor: {
@ -36,9 +42,9 @@ const blogConfig = {
}, },
giscus: { giscus: {
repo: 'kfirfitousi/blg', repo: 'kfirfitousi/blg',
repoId: 'R_kgDOI', repoId: 'R_kgDO',
category: 'Comments', category: 'Comments',
categoryId: 'DIC_kwIcM7JM4CTdK0', categoryId: 'DIC_kwM7JM4CTdK0',
mapping: 'title', mapping: 'title',
theme: { theme: {
light: 'light', light: 'light',

@ -10,7 +10,7 @@ export type BlogConfig = {
* The URL of the blog. * The URL of the blog.
* You can use localhost while developing, but make sure to change it to the actual URL when deploying. * You can use localhost while developing, but make sure to change it to the actual URL when deploying.
* Should not include a trailing slash. * Should not include a trailing slash.
* @example 'https://blog.kfirfitousi.com' * @example 'https://edu.krasnikov.pro'
* @example 'http://localhost:3000' * @example 'http://localhost:3000'
*/ */
url: string; url: string;
@ -64,6 +64,22 @@ export type BlogConfig = {
*/ */
description: string; description: string;
}; };
informatics: {
/**
* The URL of the posts page.
* If you want to use a different URL,
* make sure to rename the `app/posts` directory to match.
*/
url: `/posts/${string}`;
/**
* The title of the posts page (the part after the pipe).
*/
title: string;
/**
* The description of the posts page.
*/
description: string;
};
}; };
/** /**
* Customize the blog's theme. * Customize the blog's theme.

@ -23,6 +23,43 @@ const computedFields: ComputedFields = {
}, },
}; };
export const Informatics = defineDocumentType(() => ({
name: 'Informatics',
filePathPattern: `posts/informatics/**/*.mdx`,
contentType: 'mdx',
fields: {
title: {
type: 'string',
description: 'The title of the post',
required: true,
},
date: {
type: 'date',
description: 'When the post was published',
required: true,
},
excerpt: {
type: 'string',
description: 'Short summary of the post',
required: true,
},
tags: {
type: 'list',
of: { type: 'string' },
description: 'A list of keywords that relate to the post',
required: true,
},
},
computedFields: {
url: {
type: 'string',
description: 'The URL of the post, e.g. /posts/my-post',
resolve: (post) => `/posts/informatics/${post._raw.flattenedPath}`,
},
...computedFields,
},
}));
export const Post = defineDocumentType(() => ({ export const Post = defineDocumentType(() => ({
name: 'Post', name: 'Post',
filePathPattern: `posts/**/*.mdx`, filePathPattern: `posts/**/*.mdx`,
@ -89,7 +126,7 @@ export const Page = defineDocumentType(() => ({
export default makeSource({ export default makeSource({
contentDirPath: './content', contentDirPath: './content',
documentTypes: [Post, Page], documentTypes: [Post, Page, Informatics],
mdx: { mdx: {
remarkPlugins: [ remarkPlugins: [
/** /**

@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
<url><loc>https://edu.krasnikov.pro/posts</loc><lastmod>2023-09-09T20:05:09.923Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url> <url><loc>https://edu.krasnikov.pro/about</loc><lastmod>2023-09-12T22:31:35.044Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://edu.krasnikov.pro/posts/olimp/practice-test-10-11-robotics</loc><lastmod>2023-09-09T20:05:09.924Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url> <url><loc>https://edu.krasnikov.pro/posts/informatics/python-data-types-solution</loc><lastmod>2023-09-12T22:31:35.045Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://edu.krasnikov.pro/posts/olimp/practice-test-5-6-robotics</loc><lastmod>2023-09-09T20:05:09.924Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url> <url><loc>https://edu.krasnikov.pro/posts/informatics/word-creating-tables</loc><lastmod>2023-09-12T22:31:35.045Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://edu.krasnikov.pro/about</loc><lastmod>2023-09-09T20:05:09.924Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url> <url><loc>https://edu.krasnikov.pro/posts/olimp/practice-test-10-11-robotics</loc><lastmod>2023-09-12T22:31:35.045Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://edu.krasnikov.pro</loc><lastmod>2023-09-09T20:05:09.924Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url> <url><loc>https://edu.krasnikov.pro/posts/olimp/practice-test-5-6-robotics</loc><lastmod>2023-09-12T22:31:35.045Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://edu.krasnikov.pro/posts</loc><lastmod>2023-09-12T22:31:35.045Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://edu.krasnikov.pro</loc><lastmod>2023-09-12T22:31:35.045Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
</urlset> </urlset>
Loading…
Cancel
Save