Skip to content

添加分类/标签模块,支持在Cloudflare pages部署#5

Open
wowmarcomei wants to merge 5 commits intoguangzhengli:mainfrom
wowmarcomei:dev
Open

添加分类/标签模块,支持在Cloudflare pages部署#5
wowmarcomei wants to merge 5 commits intoguangzhengli:mainfrom
wowmarcomei:dev

Conversation

@wowmarcomei
Copy link

@wowmarcomei wowmarcomei commented Apr 27, 2025

  1. 支持分类/标签。
    image

2.用户按需配置是否支持显示标签与分类。在lib/config.ts中添加配置:

  // 文章分类显示控制
  article_category: {
    navbar: true,  // 在导航栏中显示分类
    sidebar: true, // 在侧边栏中显示分类
  },
  // 文章标签显示控制
  article_tag: {
    navbar: true,  // 在导航栏中显示标签
    sidebar: true, // 在侧边栏中显示标签
  },

设置为false时不显示,设置为true才显示分类与标签。
image

  1. 标签页支持搜索
    image

  2. 另外由于Cloudflare pages不支持中文路由,所以改造了路由方式,路由全部设置为英文,页面显示分类与标签根据用户添加的元数据显示。

如, hello-word.md文档中的元数据添加category,categoryDisplay,tags和tagsDisplay字段:
---
title: Markdown 基本用法
date: 2025-04-05T20:10:00+08:00
updated: 2025-04-05T20:10:00+08:00
keywords: ["hello", "world"]
featured: true
summary: "这篇文章包含markdown语法基本的内容。"
category: "tutorial"
categoryDisplay: "教程"
tags: ["markdown", "syntax", "beginner"]
tagsDisplay: ["Markdown", "语法", "入门"]
---
其中,category与tags是用于路由的路径,categoryDisplay和tagsDisplay字段是页面显示的。

@vercel
Copy link

vercel bot commented Apr 27, 2025

@wowmarcomei is attempting to deploy a commit to the guangzhengli's projects Team on Vercel.

A member of the Team first needs to authorize it.

@guangzhengli
Copy link
Owner

您好,参考 #2 的回复,暂时不考虑分类和归档等功能,因为使用的人少,加上每个人需要的功能不一样,本模板希望保持最简洁的状态。

但是欢迎二次开源,希望您可以留下开源地址,我可以补充到 README 中和后续的博客中,方便其它有需要的人可以作为参考。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants