feat: disable to use the path as the category

This commit is contained in:
KazooTTT
2025-01-04 12:13:12 +08:00
parent 77f2cf5356
commit 41f21eb853
2 changed files with 14 additions and 8 deletions

View File

@ -7,6 +7,7 @@ const contentDir = path.join(__dirname, '../src/content/post')
// full path, root path, parent path
const getCategoryMode = 'parent'
const isGetCategoryFromPath = false
function toCamelCase(str) {
return str
@ -56,6 +57,11 @@ function getCategoryFromPath(filePath) {
function processFile(filePath) {
const fileContent = fs.readFileSync(filePath, 'utf8')
if (!isGetCategoryFromPath) {
return
}
const category = getCategoryFromPath(filePath)
if (!category) {

View File

@ -1,17 +1,17 @@
---
import PageLayout from '../layouts/BaseLayout.astro'
import Section from '../components/Section.astro'
import Card from '../components/Card.astro'
import ProjectCard from '../components/ProjectCard.astro'
import Label from '../components/Label.astro'
import SkillLayout from '../components/SkillLayout.astro'
import PostPreview from '@/components/blog/PostPreview.astro'
import { Image } from 'astro:assets'
import kazootttAvatar from '../assets/kazoottt-avatar.jpeg'
import Card from '../components/Card.astro'
import Label from '../components/Label.astro'
import ProjectCard from '../components/ProjectCard.astro'
import Section from '../components/Section.astro'
import SkillLayout from '../components/SkillLayout.astro'
import PageLayout from '../layouts/BaseLayout.astro'
import GiscusComment from '@/components/GiscusComment'
import { getAllPosts, sortMDByDate } from '@/utils'
import { Icon } from 'astro-icon/components'
import GiscusComment from '@/components/GiscusComment'
const frontend = ['react(熟悉)', 'vue2(了解)', 'vtk.js(了解)', 'next.js', 'tailwindcss']
const backend = ['nodejs(熟悉)', 'python(了解)', 'elysiajs', 'nextjs', 'cloudflare d1', 'prisma']
@ -36,7 +36,7 @@ const directProjects = [
// Get projects from markdown
const mdProjects = allPosts
.filter((post) => post.data.category === '项目-已结项')
.filter((post) => post.data.category === '项目')
.sort((a, b) => {
if (a.data.pinned && !b.data.pinned) return -1
if (!a.data.pinned && b.data.pinned) return 1