bill-xia / hexo-theme-mashiro

CTeX-like Hexo theme.
70 stars 5 forks source link

如何置顶文章 #5

Closed enoche closed 1 year ago

enoche commented 1 year ago

RT. 谢谢!

bill-xia commented 1 year ago

我在develop分支下commit了一版,增加了这个功能。您可以拉取develop分支的主题代码,并在想要置顶的文章的front-matter里加一个pinned字段,写入一个整数,如下所示:

---
title: your title
pinned: 1
---

这篇文章就应当被置顶了。如果有多篇需要置顶的文章,可以设置不同的pinned值来为他们排序,pinned值小的在前。pinned值相同时按照时间顺序排序,较新的在前。

如果您测试后没问题,希望您能在这里给出反馈,我会写好文档后合并到主线里。

bill-xia commented 1 year ago

好像有点问题...没能全站置顶,只能把它在当前页的文章中置顶,我再改改吧。

bill-xia commented 1 year ago

参考这个链接:https://github.com/hexojs/hexo-generator-index#usage 兜兜转转官方都实现好了;-) 他只能在主页置顶,archive页里不能置顶,不知道能否满足您的需求。

enoche commented 1 year ago

非常感谢,我试试!

enoche commented 1 year ago

参考这个链接:https://github.com/hexojs/hexo-generator-index#usage 兜兜转转官方都实现好了;-) 他只能在主页置顶,archive页里不能置顶,不知道能否满足您的需求。

这个主页置顶,我估计得在另一个账号中试试,回头我反馈您!

xinzhou-ai commented 1 year ago

我测试了下:发现没有办法直接hexo g生成静态文件

ERROR TypeError: C:github.io\themes\mashiro\layout\layout.ejs:17 15|

16| <%- partial('_partial/mobile-nav', null, {cache: !config.relative_link}) %>

17| <%- partial('_partial/after-footer') %>

C:.github.io\themes\mashiro\layout_partial\after-footer.ejs:25 23| <%- partial('gauges-analytics') %> 24|

25| <% if(theme.valine.enable && theme.valine.appId && theme.valine.appKey){ %> 26| <%- js('https://cdn.jsdelivr.net/npm/valine@1.3.10/dist/Valine.min.js') %> 27| Githubissues.

  • Githubissues is a development platform for aggregating issues.