对Apollo极简主题的增强性优化

Apollo主题

将主题切换为apollo

apollo主题已停更多年,jade需全部替换为pug

报错

本地测试报错

extends partial/layout block container include mixins/post +posts() block pagination include mixins/paginator +home() block copyright include partial/copyright

提示需要安装 hexo-renderer-jade ,个人不推荐

可安装 hexo-renderer-pug 并将所有 jade 转为 pug

npm install hexo-renderer-pug --save

关闭其他页创建时间显示

themes/apollo/layout/mixins/post.pug

    .post-info
+       if (is_home() || is_post())    
            != full_date(item.date, 'll')
			if item.from && (is_home() || is_post())
				a.post-from(href=item.from target="_blank" title=item.from)!= __('translated')

文章页标签展示

themes/apollo/layout/mixins/post.pug

+        - var transform = function(str) { return '# ' + str; }
+        - var config = {class: 'post-tag', show_count: false, style: false, separator: ' ', transform: transform}
+        .post-tags
+            if is_post()
+                != list_tags(item.tags, config)

文章页侧边栏目录展示

themes/apollo/layout/mixins/post.pug

+    if is_post()
+        .post-toc
+                h3.post-toc-title
+                    != item.title
+                nav#toc-nav.navbar
+                    != toc(item.content, { list_number: false, class: 'nav' })  

themes/apollo/layout/partia/layout.pug

    body
+       .container(data-bs-spy="scroll" data-bs-target="#toc-nav" data-bs-offset=0)
        .wrap


        include scripts
+       script(src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/js/bootstrap.min.js")