airene / vitepress-blog-pure

a vitepress theme for blog, demo ↓
https://ti.bi
MIT License
168 stars 25 forks source link

文章浏览时候,能够把该文章包含的TAGS也展示出来 #18

Closed xu4wang closed 2 months ago

xu4wang commented 6 months ago

这是一个干净优雅的blog theme 👍

提一个小需求。 文章浏览时候,能够把该文章包含的TAGS也展示出来 这样方便读者根据tags跳转到相关的其它文章。

airene commented 6 months ago

明显可用的方法是类似Comment的方式,但是还是不够优雅,每个里面都要加一句,这算是一个通用需求,等我稍后再过一遍官方文档看看有没有更优雅的非“入侵”的方式。

airene commented 6 months ago

非入侵的方式只能加到标题上面, https://ti.bi/posts/cloud_wireguard_lan_to_lan.html 这种,好在从样式和大小来看不怎么干扰阅读,我还能接受, 文件差异看https://github.com/airene/vitepress-blog-pure/commit/f005b74c477c0bec1d24513061ebf0b9841b1cfc

xu4wang commented 6 months ago

非入侵的方式只能加到标题上面, https://ti.bi/posts/cloud_wireguard_lan_to_lan.html 这种,好在从样式和大小来看不怎么干扰阅读,我还能接受, 文件差异看f005b74

强 👍 我先抄过来用下。

另一个可能的解决方案:可以把文章的标题从front matter里面取出来,单独在template里面显示,tag就可以放到标题下面了。 这样,在文章中也就不需要 # {{ $frontmatter.title }} 了。

airene commented 6 months ago

非入侵的方式只能加到标题上面, https://ti.bi/posts/cloud_wireguard_lan_to_lan.html 这种,好在从样式和大小来看不怎么干扰阅读,我还能接受, 文件差异看f005b74

强 👍 我先抄过来用下。

另一个可能的解决方案:可以把文章的标题从front matter里面取出来,单独在template里面显示,tag就可以放到标题下面了。 这样,在文章中也就不需要 # {{ $frontmatter.title }} 了。

这个方案不知道这样对本地搜索有没有影响,看了一下搜索页面,盲猜可能会有影响。

xu4wang commented 6 months ago

非入侵的方式只能加到标题上面, https://ti.bi/posts/cloud_wireguard_lan_to_lan.html 这种,好在从样式和大小来看不怎么干扰阅读,我还能接受, 文件差异看f005b74

强 👍 我先抄过来用下。 另一个可能的解决方案:可以把文章的标题从front matter里面取出来,单独在template里面显示,tag就可以放到标题下面了。 这样,在文章中也就不需要 # {{ $frontmatter.title }} 了。

这个方案不知道这样对本地搜索有没有影响,看了一下搜索页面,盲猜可能会有影响。

有影响。 请教下,本地搜索会和markdown文件中的 h1 相关吗? 不太了解这个本地搜索的逻辑,有h1的情况下,有时候中文也搜不到。

airene commented 6 months ago

我简单看过,本地也类似有一个简单的分词器的概念,搜不到就有点像es的未命中。

xu4wang commented 6 months ago

非入侵的方式只能加到标题上面, https://ti.bi/posts/cloud_wireguard_lan_to_lan.html 这种,好在从样式和大小来看不怎么干扰阅读,我还能接受, 文件差异看f005b74

强 👍 我先抄过来用下。 另一个可能的解决方案:可以把文章的标题从front matter里面取出来,单独在template里面显示,tag就可以放到标题下面了。 这样,在文章中也就不需要 # {{ $frontmatter.title }} 了。

这个方案不知道这样对本地搜索有没有影响,看了一下搜索页面,盲猜可能会有影响。

我还是按照这个方案改了。去掉 blog里面的 # {{ $frontmatter.title }} 感觉舒服些。 搜索的问题,后续再看有没有其它办法了。

感谢🙏

airene commented 6 months ago

没事,客气