初始化项目

This commit is contained in:
2025-08-24 10:42:55 +08:00
commit 1f386abbcc
22 changed files with 6841 additions and 0 deletions

View File

@@ -0,0 +1,105 @@
// 主题独有配置
import { getThemeConfig } from '@sugarat/theme/node'
// 开启RSS支持RSS配置
// import type { Theme } from '@sugarat/theme'
// const baseUrl = 'https://sugarat.top'
// const RSS: Theme.RSSOptions = {
// title: '粥里有勺糖',
// baseUrl,
// copyright: 'Copyright (c) 2018-present, 粥里有勺糖',
// description: '你的指尖,拥有改变世界的力量(大前端相关技术分享)',
// language: 'zh-cn',
// image: 'https://img.cdn.sugarat.top/mdImg/MTY3NDk5NTE2NzAzMA==674995167030',
// favicon: 'https://sugarat.top/favicon.ico',
// }
// 所有配置项,详见文档: https://theme.sugarat.top/
const blogTheme = getThemeConfig({
// 开启RSS支持
// RSS,
// 搜索
// 默认开启pagefind离线的全文搜索支持如使用其它的可以设置为false
// search: false,
// 默认开启 markdown 图表支持(会增加一定的构建耗时)
// mermaid: false
// 页脚
footer: {
// message 字段支持配置为HTML内容配置多条可以配置为数组
// message: '下面 的内容和图标都是可以修改的噢(当然本条内容也是可以隐藏的)',
copyright: 'MIT License | 粥里有勺糖',
// icpRecord: {
// name: '蜀ICP备19011724号',
// link: 'https://beian.miit.gov.cn/'
// },
// securityRecord: {
// name: '公网安备xxxxx',
// link: 'https://www.beian.gov.cn/portal/index.do'
// },
},
// 主题色修改
themeColor: 'el-blue',
// 文章默认作者
author: '粥里有勺糖',
// 友链
friend: [
{
nickname: '粥里有勺糖',
des: '你的指尖用于改变世界的力量',
avatar:
'https://img.cdn.sugarat.top/mdImg/MTY3NDk5NTE2NzAzMA==674995167030',
url: 'https://sugarat.top',
},
{
nickname: 'Vitepress',
des: 'Vite & Vue Powered Static Site Generator',
avatar:
'https://vitepress.dev/vitepress-logo-large.webp',
url: 'https://vitepress.dev/',
},
],
// 公告
popover: {
title: '公告',
body: [
{ type: 'text', content: '👇公众号👇---👇 微信 👇' },
{
type: 'image',
src: 'https://img.cdn.sugarat.top/mdImg/MTYxNTAxODc2NTIxMA==615018765210~fmt.webp'
},
{
type: 'text',
content: '欢迎大家加群&私信交流'
},
{
type: 'text',
content: '文章首/文尾有群二维码',
style: 'padding-top:0'
},
{
type: 'button',
content: '作者博客',
link: 'https://sugarat.top'
},
{
type: 'button',
content: '加群交流',
props: {
type: 'success'
},
link: 'https://theme.sugarat.top/group.html',
}
],
duration: 0
},
})
export { blogTheme }

View File

@@ -0,0 +1,58 @@
import { defineConfig } from 'vitepress'
// 导入主题的配置
import { blogTheme } from './blog-theme'
// 如果使用 GitHub/Gitee Pages 等公共平台部署
// 通常需要修改 base 路径,通常为“/仓库名/”
// 如果项目名已经为 name.github.io 域名,则不需要修改!
// const base = process.env.GITHUB_ACTIONS === 'true'
// ? '/vitepress-blog-sugar-template/'
// : '/'
// Vitepress 默认配置
// 详见文档https://vitepress.dev/reference/site-config
export default defineConfig({
// 继承博客主题(@sugarat/theme)
extends: blogTheme,
// base,
lang: 'zh-cn',
title: '@sugarat/theme',
description: '粥里有勺糖的博客主题,基于 vitepress 实现',
lastUpdated: true,
// 详见https://vitepress.dev/zh/reference/site-config#head
head: [
// 配置网站的图标(显示在浏览器的 tab 上)
// ['link', { rel: 'icon', href: `${base}favicon.ico` }], // 修改了 base 这里也需要同步修改
['link', { rel: 'icon', href: '/favicon.ico' }]
],
themeConfig: {
// 展示 2,3 级标题在目录中
outline: {
level: [2, 3],
label: '目录'
},
// 默认文案修改
returnToTopLabel: '回到顶部',
sidebarMenuLabel: '相关文章',
lastUpdatedText: '上次更新于',
// 设置logo
logo: '/logo.png',
// editLink: {
// pattern:
// 'https://github.com/ATQQ/sugar-blog/tree/master/packages/blogpress/:path',
// text: '去 GitHub 上编辑内容'
// },
nav: [
{ text: '首页', link: '/' },
{ text: '关于作者', link: 'https://sugarat.top/aboutme.html' }
],
socialLinks: [
{
icon: 'github',
link: 'https://github.com/ATQQ/sugar-blog/tree/master/packages/theme'
}
]
}
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -0,0 +1,9 @@
import BlogTheme from '@sugarat/theme'
// 自定义样式重载
// import './style.scss'
// 自定义主题色
// import './user-theme.css'
export default BlogTheme

View File

@@ -0,0 +1,13 @@
.VPHome {
// 定义遮罩样式
background: radial-gradient(ellipse,
rgba(var(--bg-gradient-home), 1) 0%,
rgba(var(--bg-gradient-home), 0) 150%);
// 自定义首页背景图
&::before {
// 图片来源https://zhuanlan.zhihu.com/p/54060187
background-image: url(./assets/bg.webp);
background-size: cover;
}
}

View File

@@ -0,0 +1,26 @@
/* 所有变量https://github.com/vuejs/vitepress/blob/main/src/client/theme-default/styles/vars.css */
/* 自定义主题色示例,如下 */
/* 浅色模式使用的变量 */
html[theme] {
--vp-c-user-1:red;
--vp-c-user-2:blue;
--vp-c-user-3:green;
--vp-c-user-soft:rgba(255,0,0,.5);
}
/* 深色模式使用的变量 */
html[theme].dark {
--vp-c-user-1:yellow;
--vp-c-user-2:purple;
--vp-c-user-3:orange;
--vp-c-user-soft:rgba(255,255,0,.5);
}
/* 覆盖默认变量 */
html[theme],html[theme].dark {
--vp-c-brand-1: var(--vp-c-user-1);
--vp-c-brand-2: var(--vp-c-user-2);
--vp-c-brand-3: var(--vp-c-user-3);
--vp-c-brand-soft: var(--vp-c-user-soft);
}