惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Microsoft Azure Blog
Microsoft Azure Blog
Engineering at Meta
Engineering at Meta
A
About on SuperTechFans
T
The Blog of Author Tim Ferriss
I
InfoQ
博客园_首页
G
Google Developers Blog
爱范儿
爱范儿
Last Week in AI
Last Week in AI
量子位
阮一峰的网络日志
阮一峰的网络日志
雷峰网
雷峰网
酷 壳 – CoolShell
酷 壳 – CoolShell
Vercel News
Vercel News
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
GbyAI
GbyAI
月光博客
月光博客
The GitHub Blog
The GitHub Blog
V
Visual Studio Blog
N
Netflix TechBlog - Medium
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 司徒正美
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 聂微东

OhYee 博客

小鹏辅助驾驶测评|OhYee 博客 小鹏非支持手机开启自动解锁|OhYee 博客 使用函数计算实现 301 重定向|OhYee 博客 针对 HTML 内容使用 Ant Design 图片弹框|OhYee 博客 博客进程泄露及僵尸进程解决|OhYee 博客 蓝易云服务器体验|OhYee 博客 SSH 调起本地 VSCode|OhYee 博客 【2022 秋招内推】阿里云后端研发工程师|OhYee 博客 使用函数计算获取 IP 地址信息|OhYee 博客 正确获取客户端 IP/HTTP Header 也可能重复|OhYee 博客 评测 Oculus Quest2 及 BigScreen|OhYee 博客 NextJS 热重载保留状态|OhYee 博客 如何优雅地贴 gist 代码|OhYee 博客 Linux 精细化文件权限|OhYee 博客 VSCode 容器开发环境|OhYee 博客 Clash 的不兼容更新排查|OhYee 博客 Zeek 导出 PCAP|OhYee 博客 记一次 ssh 配置问题|OhYee 博客 Git Commit 规范化工具|OhYee 博客 谈谈《星之卡比-探索发现》|OhYee 博客 VSCode 快捷键绑定 Shell 命令|OhYee 博客 ASN.1 语法及 X.509 证书格式解析解析|OhYee 博客 腾讯企业邮箱忽略 MX 记录发信|OhYee 博客 Chrome/Edge 标签组插件|OhYee 博客 【应届内推】阿里云后端研发工程师|OhYee 博客 损坏的 Typecho 备份处理为 JSON|OhYee 博客 VS Code VIM 插件高效使用|OhYee 博客 SSH 正反向代理|OhYee 博客 Let's Encrypt 根证书过期引发的问题|OhYee 博客 OpenWRT 忽略内核依赖|OhYee 博客
hexo next主题二级分类中的分隔符如何设置成下图这样的格式?...
2017-04-01 · via OhYee 博客

https://www.zhihu.com/question/57888214/answer/154699381

{% note %}

Hexo_separator_1Hexo_separator_1


{% endnote %}

没有太理解你的具体意思,大概有两种理解吧

  • 如何生成二级分类
  • 如何显示 ">" 这个符号

对于第一种理解

只需要

---
title: t
date: 2017-04-01 00:44:21
categories: 
- 笔记
- 题解
- t
tags:
---

就可以实现(要求没产生分类连成有向图没有回路)

Hexo_separator_1Hexo_separator_1

如果是第二种,以 NexT 主题为例

Blog\themes\next\layout\_macro\post.swig
文件里有

{% if post.categories and post.categories.length and theme.post_meta.categories %}
    <span class="post-category" >
    {% if theme.post_meta.created_at or theme.post_meta.updated_at %}
        <span class="post-meta-divider">|</span>
    {% endif %}
        <span class="post-meta-item-icon">
            <i class="fa fa-folder-o"></i>
        </span>
        {% if theme.post_meta.item_text %}
            <span class="post-meta-item-text">{{ __('post.in') }}</span>
        {% endif %}
        {% for cat in post.categories %}
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
            <a href="{{ url_for(cat.path) }}" itemprop="url" rel="index">
                <span itemprop="name">{{ cat.name }}</span>
            </a>
        </span>

        {% set cat_length = post.categories.length %}
            {% if cat_length > 1 and loop.index !== cat_length %}
                {{ __('symbol.comma') }}
            {% endif %}
        {% endfor %}
    </span>
{% endif %}

这一段就是相应的代码

可以看出来

<span class="post-meta-item-icon">
    <i class="fa fa-folder-o"></i>
</span>

这一部分是分类的小图标

<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
    <a href="{{ url_for(cat.path) }}" itemprop="url" rel="index">
        <span itemprop="name">{{ cat.name }}</span>
    </a>
</span>

这一部分是生成链接

{% if cat_length > 1 and loop.index !== cat_length %}
    {{ __('symbol.comma') }}
{% endif %}

这一部分就是产生分隔符号(如果多余一个分类并且当前循环不是最后一个)

__('symbol.comma')
这个就是 "," 把它改成 ">" 即可(直接写成文本就行)