Comments (5)
https://theme.sugarat.top/config/global.html#recommend
可以看一下全局的 recommend 配置 里的filter 方法。
理论上列表为空的时候就可以不展示 主题内置的这个相关文章。
from sugar-blog.
const blogTheme = getThemeConfig({
recommend: {
filter(page){
// 筛选过滤为空数组
},
empty: false // false时无推荐文章不展示此模块
}
})
from sugar-blog.
那么我要如何才能显示出来 博客主题 下的 相关文章 侧边栏了?
我现在是想某个文件夹下面的文档按照vitepress的sidebar来配置,我们可以控制分类。
其他的文章就算是博客文章,按照我们的主题来配置,左侧出现的是 相关文章 类似的配置。
问题是:我为doc设置sidebar之后,非doc文件夹下的博客文章的侧边栏就不会显示出来。
{
sidebar: {
'/doc/': {
base: '/doc/',
items: [
{
text: '简介',
collapsed: false,
items: [
{
text: '指引',
link: 'guide'
}
]
}
]
}
},
}
{
// 推荐文章
recommend: {
// 当没有推荐文章时的提示,设置为 false 则不展示
empty: false,
filter: (page) => {
// console.log(page)
if (page.route.startsWith('/doc/')) {
return false
}
return true
}
}
}
谢谢
from sugar-blog.
sidebar 配置成一个数组,加入一项这个
sidebar: [
{
text: '',
items: []
}
]
from sugar-blog.
这样设置is OK。
sidebar: {
'/': {
base: '/',
items: [{
text: '',
items: []
}]
},
'/doc/': {
base: '/doc/',
items: sidebarDoc()
}
}
感谢提示。
from sugar-blog.
Related Issues (20)
- Mermaid流程图打包问题 HOT 1
- [feat] vitepress-plugin-pagefind 可否增加类似 minisearch 的搜索预览 HOT 4
- 若干个问题 HOT 3
- 首页精选文章跳转错误的问题 HOT 3
- 更新0.2.30,mac打包内存溢出 HOT 9
- 文案错误 HOT 1
- 能否把 pagefind 作为依赖自动安装 HOT 2
- 超大vitepress 项目下,pagefind 插件不能正常工作 HOT 22
- Typo HOT 2
- vitepress-plugin-pagefind: v0.4.4 breaks rendering HOT 8
- pagefind插件,如果md中出现<script setup lang="ts">标签将无法索引 HOT 15
- vitepress-plugin-pagefind: v0.4.4 broke dynamic route pages HOT 3
- RSS 文件内容出现乱码问题 HOT 3
- 请问一下大佬,如何修改底部栏呢? HOT 2
- 更新依赖后,SASS 会报警告 HOT 3
- 生成的 rss 带有 `​` HOT 2
- 使用vitepress-plugin-rss 在打包时出现问题 cdata.replace is not a function HOT 7
- GitHub Pages 改用自己的網域 CSS 沒有套用 HOT 3
- 詢問一些小問題 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sugar-blog.