vuepress踩坑:
自定义域那么config文件里面base应该填/,如果是仓库就是仓库名,如果是用户名,那还是/
在每次提交gh-pages分支后,设置的域名都会被清空,
创建 docs/.vuepress/public/CNAME,创建CNAME文件后,在编辑区域中输入你的自定义域名。
开启github送的网址出现构建错误,把选择文件改为/root
就可以了
navbar是导航栏,坑是:是目录就要用双斜杠包裹/dist/,单纯的md文件就用单斜杠/,
例如:
{ text: '首页', link: '/' },
{ text: '知识', link: '/MySQL/' },
sidebar:就是侧边栏,前后代表先后顺序,不过vuepress-theme-hope主题可以自动生成侧边栏,侧边栏的显示顺序,在Markdown文件开始部分的Front Matter中,可以指定一个sidebar属性来控制侧边栏的显示顺序。
不同的主题在谷歌搜索vuepress-theme-hope如何控制侧边栏顺序呢
就行
例如:
---
order: 2
---
# 页面标题
实现悬浮导航栏中的分类显示( 引入了children
属性来定义子链接列表。这意味着当用户将鼠标悬浮在这些项上时,会显示出一个包含更具体选项的下拉菜单。)
例如:
{
text: '知识',
children: [
{ text: 'MySQL知识点', link: '/MySQL/' },
{ text: '其他知识点', link: '/other-knowledge/' },
],
},
{
text: '实验',
children: [
{ text: 'Markdown知识点', link: '/Markdown知识点/' },
{ text: '其他实验内容', link: '/other-experiments/' },
],
}
页面 frontmatter 基本数据:
---
title: 无用
date: 2023-01-01
category:
- 前端
tag:
- 无用
- 世界
order: 1
---
没有实现点击不同导航栏。每个导航栏都可以展示不同的内容,并且它们之间互相独立。是侧边栏的锅,侧边栏配置没有写好。
实现不同的页面组来显示不同的侧边栏,侧边栏这么写:
sidebar: {
'/guide/vue/': "structure",
'/guide/ts/': "structure",
},
是对于每个页面加structure,而不是一整个的加structure。
设置首页的背景图片:
bgImage: "/示例.png"
bgImageStyle: { height: "100%", boxShadow: "0 15px 18px rgba(0,0,0,0.2)" }
图片静态文件保存在.vuepress\public文件夹里面
为vuepress增加评论功能,vuepress-theme-hope主题的步骤是这样的:
第一步:创建一个仓库,开启issues和Discussions ,在setting页面点击 General按钮 滑动到Features部分,在哪里开启:
第二步,安装giscus,点击这个网址
https://github.com/apps/giscus
第三步,进入这个网址
https://giscus.app/zh-CN
,填写仓库和Discussions 分类。第四步, 之后滚动到页面下部的 “启用 giscus” 部分,复制
data-repo
, data-repo-id
, data-category
和 data-category-id
四项,第五步,在config.js里面theme配置填写:
comment: {
provider: 'Giscus',
repo: 'red-cocode/blog-comment',
repoId: 'R_kgDOLrQHMQ',
category: 'Announcements',
categoryId: 'DIC_kwDOLrQHMc4CeiYS',
},
或者:
plugins: {
comment: {
provider: 'Giscus',
repo: 'red-cocode/blog-comment',
repoId: 'R_kgDOLrQHMQ',
category: 'Announcements',
categoryId: 'DIC_kwDOLrQHMc4CeiYS',
},
},
例如:
删除评论:
在项目页面,点击 "Discussions" 标签。
寻找与你在Vuepress中看到的Giscus评论相关的讨论,点击进入。
在讨论页面中,找到你想要删除的评论,然后点击评论右下角的 "..." 按钮。
在弹出的菜单中,选择 "Delete". 确认删除后,你的评论将会被永久删除。
如果评论区尺寸和之前的不一样,那么就是依赖出问题,删除依赖(node_modules和package-lock.json)重新安装就行
npm install --legacy-peer-deps
。例如这样的就是评论区尺寸和之前的不一样,是依赖问题。
在页面里面放置视频,先安装
vidstack
命令:npm install vidstack@1
,之后在config里面plugins添加组件
plugins: {
comment: {
provider: 'Giscus',
repo: 'red-cocode/blog-comment',
repoId: 'R_kgDOLrQHMQ',
category: 'Announcements',
categoryId: 'DIC_kwDOLrQHMc4CeiYS',
position:'bottom',
},
components: {
// 你想使用的组件
components: ["VidStack"],
},
},
之后就可以在文章里面放置视频了,例如:
<VidStack src="https://vp-demo.u2sb.com/video/caminandes_03_llamigos_720p.mp4" />
放置YouTube视频:
<VidStack src="youtube/wGCn_s-Ve4o&t=11s" title="sexy girl"/>
wGCn_s-Ve4o&t=11s
是是视频的唯一的标识符ID,title是可以随便取,这个是给用户看的,不是视频的标题
放置b站的视频,components里面需要增加一个组件BiliBili
,例如:
plugins: {
comment: {
provider: 'Giscus',
repo: 'red-cocode/blog-comment',
repoId: 'R_kgDOLrQHMQ',
category: 'Announcements',
categoryId: 'DIC_kwDOLrQHMc4CeiYS',
position:'bottom',
},
components: {
// 你想使用的组件
components: ["BiliBili","VidStack"],
},
},
之后这么写:
<BiliBili bvid="BV1kt411o7C3" />
bvid唯一值
安装搜索栏:
npm i -D vuepress-plugin-search-pro
之后在config.js里面这么写:
plugins: {
comment: {
provider: 'Giscus',
repo: 'red-cocode/blog-comment',
repoId: 'R_kgDOLrQHMQ',
category: 'Announcements',
categoryId: 'DIC_kwDOLrQHMc4CeiYS',
position:'bottom',
},
components: {
components: ["BiliBili", "VidStack"],
},
searchPro: {
searchMaxSuggestions: 10,
searchPlaceholder: '搜索文档',
}
},
图标,这个网址:https://icon-sets.iconify.design/
在theme里面填写:iconAssets: "iconify",
icon填写
docsearchPlugin需要申请,网址是https://docsearch.algolia.com/apply/
,具体教程是https://ecosystem.vuejs.press/zh/plugins/docsearch.html
首页不用专门为其设置导航栏。
package.json 是一个JSON格式的文件,它是Node.js项目的心脏,用于存储项目的元数据以及管理项目的依赖、脚本、版本等信息。
config.js相当于布局应用需要的配置。
有children就是可以悬浮显示
有一个疑问,怎么给自己网站加cloudflare的cdn,我只会给图片加CDN,例如
免费的CDN加速:
https://cdn.jsdelivr.net/gh/用户名/仓库名@版本/文件路径
例如如何加速这个文件啊:
用户名:ceo-code1,仓库名:image,分支:main,文件路径:龙莹.jpg
https://cdn.jsdelivr.net/gh/ceo-code1/image@main/龙莹.jpg
https://linux.do/t/topic/49227
我是看这个才知道可以使用CDN对网站进行加速。
我的eu.org域名被墙了,可以通过这个绕开墙吗,如何使用cloudflare的cdn对我的网站https://blog.wangyu2018.eu.org/
进行绕过呢,如果不能绕开,那么如何进行加速呢,不是单纯的进行绕墙,主要是不懂如何使用CDN对网站进行加速
有用信息:
找到一篇相关的文章:
https://dooo.ng/archives/1701171631107
,不过暂时不能消化https://www.baota.me/post-433.html
这个不懂:
需要信用卡:
寄了,等待其他大佬继续吧!!!