修改配置文件
This commit is contained in:
+2
-1
@@ -4,9 +4,10 @@ import { unified } from '@astrojs/markdown-remark';
|
|||||||
import rehypeMathjax from 'rehype-mathjax';
|
import rehypeMathjax from 'rehype-mathjax';
|
||||||
import remarkMath from 'remark-math';
|
import remarkMath from 'remark-math';
|
||||||
import remarkHexoLinkCards from './src/lib/remarkHexoLinkCards.mjs';
|
import remarkHexoLinkCards from './src/lib/remarkHexoLinkCards.mjs';
|
||||||
|
import { siteConfig } from './site.config.mjs';
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
site: 'https://blog.biss.click',
|
site: siteConfig.site.url,
|
||||||
output: 'static',
|
output: 'static',
|
||||||
integrations: [sitemap()],
|
integrations: [sitemap()],
|
||||||
markdown: {
|
markdown: {
|
||||||
|
|||||||
@@ -4,28 +4,11 @@
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
// 配置区域 - 请根据实际情况修改
|
// 配置区域 - 请根据实际情况修改
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
const CONFIG = {
|
const CONFIG = window.SITE_CONFIG?.search;
|
||||||
apiKey: "2uxQzk7eD2GBCljdSmIiuU3ause7UK9n", // ⚠️ 建议使用 Search-Only API Key
|
if (!CONFIG) {
|
||||||
server: {
|
console.warn('Typesense 搜索配置未加载');
|
||||||
host: "typesense.biss.click",
|
return;
|
||||||
port: "443",
|
|
||||||
protocol: "https"
|
|
||||||
},
|
|
||||||
indexName: "blogs",
|
|
||||||
searchParams: {
|
|
||||||
query_by: "title,content",
|
|
||||||
highlight_full_fields: "title,content",
|
|
||||||
per_page: 8,
|
|
||||||
num_typos: 1,
|
|
||||||
typo_tokens_threshold: 1,
|
|
||||||
prefix: true
|
|
||||||
},
|
|
||||||
ui: {
|
|
||||||
maxRetries: 10,
|
|
||||||
retryDelay: 100,
|
|
||||||
animationDuration: 300
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// 状态管理
|
// 状态管理
|
||||||
@@ -34,7 +17,7 @@
|
|||||||
let isInitialized = false;
|
let isInitialized = false;
|
||||||
let isSearchOpen = false;
|
let isSearchOpen = false;
|
||||||
let initRetryCount = 0;
|
let initRetryCount = 0;
|
||||||
const MAX_INIT_RETRIES = 30; // 最多重试30次 (3秒)
|
const MAX_INIT_RETRIES = CONFIG.ui.maxInitRetries || 30; // 最多重试30次 (3秒)
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// 错误提示函数
|
// 错误提示函数
|
||||||
@@ -326,7 +309,7 @@
|
|||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
mask.style.display = 'none';
|
mask.style.display = 'none';
|
||||||
document.body.style.overflow = '';
|
document.body.style.overflow = '';
|
||||||
}, CONFIG.ui.animationDuration);
|
}, CONFIG.ui.animationDuration || 300);
|
||||||
}
|
}
|
||||||
|
|
||||||
function focusSearchInput(retryCount) {
|
function focusSearchInput(retryCount) {
|
||||||
@@ -335,10 +318,10 @@
|
|||||||
if (input) {
|
if (input) {
|
||||||
input.focus();
|
input.focus();
|
||||||
input.select();
|
input.select();
|
||||||
} else if (retryCount < CONFIG.ui.maxRetries) {
|
} else if (retryCount < (CONFIG.ui.maxRetries || 10)) {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
focusSearchInput(retryCount + 1);
|
focusSearchInput(retryCount + 1);
|
||||||
}, CONFIG.ui.retryDelay);
|
}, CONFIG.ui.retryDelay || 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -443,7 +426,7 @@
|
|||||||
searchInstance.addWidgets([
|
searchInstance.addWidgets([
|
||||||
instantsearch.widgets.searchBox({
|
instantsearch.widgets.searchBox({
|
||||||
container: '#searchbox',
|
container: '#searchbox',
|
||||||
placeholder: '输入关键词寻找故事...',
|
placeholder: CONFIG.ui.placeholder || '输入关键词寻找故事...',
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
showReset: true,
|
showReset: true,
|
||||||
showSubmit: false,
|
showSubmit: false,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
function renderTalks() {
|
function renderTalks() {
|
||||||
const talkContainer = document.querySelector('#talk');
|
const talkContainer = document.querySelector('#talk');
|
||||||
if (!talkContainer) return;
|
if (!talkContainer) return;
|
||||||
|
const config = window.SITE_CONFIG?.talks || {};
|
||||||
talkContainer.innerHTML = '';
|
talkContainer.innerHTML = '';
|
||||||
const generateIconSVG = () => {
|
const generateIconSVG = () => {
|
||||||
return `<svg viewBox="0 0 512 512"xmlns="http://www.w3.org/2000/svg"class="is-badge icon"><path d="m512 268c0 17.9-4.3 34.5-12.9 49.7s-20.1 27.1-34.6 35.4c.4 2.7.6 6.9.6 12.6 0 27.1-9.1 50.1-27.1 69.1-18.1 19.1-39.9 28.6-65.4 28.6-11.4 0-22.3-2.1-32.6-6.3-8 16.4-19.5 29.6-34.6 39.7-15 10.2-31.5 15.2-49.4 15.2-18.3 0-34.9-4.9-49.7-14.9-14.9-9.9-26.3-23.2-34.3-40-10.3 4.2-21.1 6.3-32.6 6.3-25.5 0-47.4-9.5-65.7-28.6-18.3-19-27.4-42.1-27.4-69.1 0-3 .4-7.2 1.1-12.6-14.5-8.4-26-20.2-34.6-35.4-8.5-15.2-12.8-31.8-12.8-49.7 0-19 4.8-36.5 14.3-52.3s22.3-27.5 38.3-35.1c-4.2-11.4-6.3-22.9-6.3-34.3 0-27 9.1-50.1 27.4-69.1s40.2-28.6 65.7-28.6c11.4 0 22.3 2.1 32.6 6.3 8-16.4 19.5-29.6 34.6-39.7 15-10.1 31.5-15.2 49.4-15.2s34.4 5.1 49.4 15.1c15 10.1 26.6 23.3 34.6 39.7 10.3-4.2 21.1-6.3 32.6-6.3 25.5 0 47.3 9.5 65.4 28.6s27.1 42.1 27.1 69.1c0 12.6-1.9 24-5.7 34.3 16 7.6 28.8 19.3 38.3 35.1 9.5 15.9 14.3 33.4 14.3 52.4zm-266.9 77.1 105.7-158.3c2.7-4.2 3.5-8.8 2.6-13.7-1-4.9-3.5-8.8-7.7-11.4-4.2-2.7-8.8-3.6-13.7-2.9-5 .8-9 3.2-12 7.4l-93.1 140-42.9-42.8c-3.8-3.8-8.2-5.6-13.1-5.4-5 .2-9.3 2-13.1 5.4-3.4 3.4-5.1 7.7-5.1 12.9 0 5.1 1.7 9.4 5.1 12.9l58.9 58.9 2.9 2.3c3.4 2.3 6.9 3.4 10.3 3.4 6.7-.1 11.8-2.9 15.2-8.7z"fill="#1da1f2"></path></svg>`;
|
return `<svg viewBox="0 0 512 512"xmlns="http://www.w3.org/2000/svg"class="is-badge icon"><path d="m512 268c0 17.9-4.3 34.5-12.9 49.7s-20.1 27.1-34.6 35.4c.4 2.7.6 6.9.6 12.6 0 27.1-9.1 50.1-27.1 69.1-18.1 19.1-39.9 28.6-65.4 28.6-11.4 0-22.3-2.1-32.6-6.3-8 16.4-19.5 29.6-34.6 39.7-15 10.2-31.5 15.2-49.4 15.2-18.3 0-34.9-4.9-49.7-14.9-14.9-9.9-26.3-23.2-34.3-40-10.3 4.2-21.1 6.3-32.6 6.3-25.5 0-47.4-9.5-65.7-28.6-18.3-19-27.4-42.1-27.4-69.1 0-3 .4-7.2 1.1-12.6-14.5-8.4-26-20.2-34.6-35.4-8.5-15.2-12.8-31.8-12.8-49.7 0-19 4.8-36.5 14.3-52.3s22.3-27.5 38.3-35.1c-4.2-11.4-6.3-22.9-6.3-34.3 0-27 9.1-50.1 27.4-69.1s40.2-28.6 65.7-28.6c11.4 0 22.3 2.1 32.6 6.3 8-16.4 19.5-29.6 34.6-39.7 15-10.1 31.5-15.2 49.4-15.2s34.4 5.1 49.4 15.1c15 10.1 26.6 23.3 34.6 39.7 10.3-4.2 21.1-6.3 32.6-6.3 25.5 0 47.3 9.5 65.4 28.6s27.1 42.1 27.1 69.1c0 12.6-1.9 24-5.7 34.3 16 7.6 28.8 19.3 38.3 35.1 9.5 15.9 14.3 33.4 14.3 52.4zm-266.9 77.1 105.7-158.3c2.7-4.2 3.5-8.8 2.6-13.7-1-4.9-3.5-8.8-7.7-11.4-4.2-2.7-8.8-3.6-13.7-2.9-5 .8-9 3.2-12 7.4l-93.1 140-42.9-42.8c-3.8-3.8-8.2-5.6-13.1-5.4-5 .2-9.3 2-13.1 5.4-3.4 3.4-5.1 7.7-5.1 12.9 0 5.1 1.7 9.4 5.1 12.9l58.9 58.9 2.9 2.3c3.4 2.3 6.9 3.4 10.3 3.4 6.7-.1 11.8-2.9 15.2-8.7z"fill="#1da1f2"></path></svg>`;
|
||||||
@@ -76,10 +77,11 @@ function renderTalks() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const fetchAndRenderTalks = () => {
|
const fetchAndRenderTalks = () => {
|
||||||
const url = 'https://mm.biss.click/api/echo/page';
|
const url = config.apiUrl;
|
||||||
const cacheKey = 'talksCache';
|
if (!url) return;
|
||||||
const cacheTimeKey = 'talksCacheTime';
|
const cacheKey = config.cacheKey || 'talksCache';
|
||||||
const cacheDuration = 30 * 60 * 1000;
|
const cacheTimeKey = config.cacheTimeKey || 'talksCacheTime';
|
||||||
|
const cacheDuration = config.cacheDurationMs || 30 * 60 * 1000;
|
||||||
const cachedData = localStorage.getItem(cacheKey);
|
const cachedData = localStorage.getItem(cacheKey);
|
||||||
const cachedTime = localStorage.getItem(cacheTimeKey);
|
const cachedTime = localStorage.getItem(cacheTimeKey);
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
@@ -90,7 +92,7 @@ function renderTalks() {
|
|||||||
fetch(url, {
|
fetch(url, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({ page: 1, pageSize: 30 })
|
body: JSON.stringify({ page: 1, pageSize: config.pageSize || 30 })
|
||||||
})
|
})
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
@@ -263,7 +265,7 @@ function renderTalks() {
|
|||||||
return {
|
return {
|
||||||
content,
|
content,
|
||||||
user: item.username || '匿名',
|
user: item.username || '匿名',
|
||||||
avatar: 'https://free.picui.cn/free/2025/08/10/689845496a283.png',
|
avatar: config.fallbackAvatar || window.SITE_CONFIG?.author?.avatar || '',
|
||||||
date,
|
date,
|
||||||
location: '',
|
location: '',
|
||||||
tags: Array.isArray(item.tags) && item.tags.length ? item.tags.map(t => t.name) : ['无标签'],
|
tags: Array.isArray(item.tags) && item.tags.length ? item.tags.map(t => t.name) : ['无标签'],
|
||||||
|
|||||||
@@ -11,6 +11,10 @@ function indexTalk() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!document.getElementById('bber-talk')) return;
|
if (!document.getElementById('bber-talk')) return;
|
||||||
|
const config = window.SITE_CONFIG?.talks || {};
|
||||||
|
const talksCacheKey = config.cacheKey || cacheKey;
|
||||||
|
const talksCacheTimeKey = config.cacheTimeKey || cacheTimeKey;
|
||||||
|
const talksCacheDuration = config.cacheDurationMs || cacheDuration;
|
||||||
|
|
||||||
function toText(ls) {
|
function toText(ls) {
|
||||||
return ls.map(item => {
|
return ls.map(item => {
|
||||||
@@ -57,29 +61,31 @@ function indexTalk() {
|
|||||||
}, 3000);
|
}, 3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
const cachedData = localStorage.getItem(cacheKey);
|
const cachedData = localStorage.getItem(talksCacheKey);
|
||||||
const cachedTime = localStorage.getItem(cacheTimeKey);
|
const cachedTime = localStorage.getItem(talksCacheTimeKey);
|
||||||
const currentTime = new Date().getTime();
|
const currentTime = new Date().getTime();
|
||||||
|
|
||||||
// 判断缓存是否有效
|
// 判断缓存是否有效
|
||||||
if (cachedData && cachedTime && (currentTime - cachedTime < cacheDuration)) {
|
if (cachedData && cachedTime && (currentTime - cachedTime < talksCacheDuration)) {
|
||||||
const data = toText(JSON.parse(cachedData));
|
const data = toText(JSON.parse(cachedData));
|
||||||
talk(data.slice(0, 6)); // 使用缓存渲染数据
|
talk(data.slice(0, config.homeLimit || 6)); // 使用缓存渲染数据
|
||||||
} else {
|
} else {
|
||||||
fetch('https://mm.biss.click/api/echo/page', {
|
if (!config.apiUrl) return;
|
||||||
|
|
||||||
|
fetch(config.apiUrl, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({ page: 1, pageSize: 30 })
|
body: JSON.stringify({ page: 1, pageSize: config.pageSize || 30 })
|
||||||
})
|
})
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
// 适配新版结构:code=1 且 data.items 存在
|
// 适配新版结构:code=1 且 data.items 存在
|
||||||
if (data.code === 1 && data.data && Array.isArray(data.data.items)) {
|
if (data.code === 1 && data.data && Array.isArray(data.data.items)) {
|
||||||
localStorage.setItem(cacheKey, JSON.stringify(data.data.items));
|
localStorage.setItem(talksCacheKey, JSON.stringify(data.data.items));
|
||||||
localStorage.setItem(cacheTimeKey, currentTime.toString());
|
localStorage.setItem(talksCacheTimeKey, currentTime.toString());
|
||||||
|
|
||||||
const formattedData = toText(data.data.items);
|
const formattedData = toText(data.data.items);
|
||||||
talk(formattedData.slice(0, 6));
|
talk(formattedData.slice(0, config.homeLimit || 6));
|
||||||
} else {
|
} else {
|
||||||
console.warn('Unexpected API response format:', data);
|
console.warn('Unexpected API response format:', data);
|
||||||
}
|
}
|
||||||
|
|||||||
+129
@@ -0,0 +1,129 @@
|
|||||||
|
export const siteConfig = {
|
||||||
|
site: {
|
||||||
|
url: 'https://blog.biss.click',
|
||||||
|
name: "Bi's Blog",
|
||||||
|
description: 'Personal blog by biss.',
|
||||||
|
language: 'zh-CN',
|
||||||
|
domain: 'blog.biss.click',
|
||||||
|
slogan: '好奇心转化为代码的空间。',
|
||||||
|
startTime: '2025-01-01T00:00:00+08:00',
|
||||||
|
copyrightStartYear: 2025,
|
||||||
|
license: '内容采用 CC BY-NC-SA 4.0 协议',
|
||||||
|
},
|
||||||
|
author: {
|
||||||
|
name: 'biss',
|
||||||
|
email: 'bishsh2006@gmail.com',
|
||||||
|
github: 'https://github.com/bishshi',
|
||||||
|
avatar: 'https://free.picui.cn/free/2025/08/10/689845496a283.png',
|
||||||
|
},
|
||||||
|
assets: {
|
||||||
|
icon: '/images/Bi.ico',
|
||||||
|
background: '/images/background.png',
|
||||||
|
},
|
||||||
|
nav: [
|
||||||
|
{ label: '归档', href: '/archives/', icon: 'fa-solid fa-box-archive' },
|
||||||
|
{ label: '分类', href: '/categories/', icon: 'fa-solid fa-folder-open' },
|
||||||
|
{ label: '标签', href: '/tags/', icon: 'fa-solid fa-tags' },
|
||||||
|
{ label: '说说', href: '/shuoshuo/', icon: 'fa-regular fa-comments' },
|
||||||
|
{ label: '关于', href: '/about/', icon: 'fa-solid fa-heart' },
|
||||||
|
{ label: '友链', href: '/link/', icon: 'fa-solid fa-link' },
|
||||||
|
],
|
||||||
|
footer: {
|
||||||
|
contactLabel: '联系方式',
|
||||||
|
links: [
|
||||||
|
{ label: '发展历程', href: '/archives/' },
|
||||||
|
{ label: '隐私政策', href: '/privacy/' },
|
||||||
|
],
|
||||||
|
poweredBy: [
|
||||||
|
{ label: 'EdgeOne', href: 'https://edgeone.ai/' },
|
||||||
|
{ label: 'ASTRO', href: 'https://astro.build/' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
social: [
|
||||||
|
{ label: '发送邮件', href: 'mailto:bishsh2006@gmail.com', icon: 'fa-solid fa-envelope' },
|
||||||
|
{ label: '订阅 RSS', href: '/rss.xml', icon: 'fa-solid fa-rss' },
|
||||||
|
{ label: 'GitHub', href: 'https://github.com/bishshi', icon: 'fa-brands fa-github', external: true },
|
||||||
|
],
|
||||||
|
pagination: {
|
||||||
|
postsPerPage: 16,
|
||||||
|
},
|
||||||
|
comments: {
|
||||||
|
envId: 'https://comment.biss.click',
|
||||||
|
region: '',
|
||||||
|
script: 'https://cdn.jsdelivr.net/npm/twikoo@1.7.7/dist/twikoo.min.js',
|
||||||
|
},
|
||||||
|
externalLinks: {
|
||||||
|
waitSeconds: 10,
|
||||||
|
whitelist: [
|
||||||
|
'blog.biss.click',
|
||||||
|
'biss.click',
|
||||||
|
'github.com',
|
||||||
|
'astro.build',
|
||||||
|
'edgeone.ai',
|
||||||
|
'localhost',
|
||||||
|
'127.0.0.1',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
talks: {
|
||||||
|
apiUrl: 'https://mm.biss.click/api/echo/page',
|
||||||
|
pageSize: 30,
|
||||||
|
homeLimit: 6,
|
||||||
|
cacheKey: 'talksCache',
|
||||||
|
cacheTimeKey: 'talksCacheTime',
|
||||||
|
cacheDurationMs: 30 * 60 * 1000,
|
||||||
|
fallbackAvatar: 'https://free.picui.cn/free/2025/08/10/689845496a283.png',
|
||||||
|
},
|
||||||
|
search: {
|
||||||
|
apiKey: '2uxQzk7eD2GBCljdSmIiuU3ause7UK9n',
|
||||||
|
server: {
|
||||||
|
host: 'typesense.biss.click',
|
||||||
|
port: '443',
|
||||||
|
protocol: 'https',
|
||||||
|
},
|
||||||
|
indexName: 'blogs',
|
||||||
|
searchParams: {
|
||||||
|
query_by: 'title,content',
|
||||||
|
highlight_full_fields: 'title,content',
|
||||||
|
per_page: 8,
|
||||||
|
num_typos: 1,
|
||||||
|
typo_tokens_threshold: 1,
|
||||||
|
prefix: true,
|
||||||
|
},
|
||||||
|
ui: {
|
||||||
|
maxRetries: 10,
|
||||||
|
retryDelay: 100,
|
||||||
|
animationDuration: 300,
|
||||||
|
maxInitRetries: 30,
|
||||||
|
placeholder: '输入关键词寻找故事...',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
cdn: {
|
||||||
|
instantsearchCss: 'https://cdn.jsdmirror.com/npm/instantsearch.css/themes/reset-min.css',
|
||||||
|
fancyboxCss: 'https://cdn.jsdmirror.com/npm/@fancyapps/ui@5.0/dist/fancybox/fancybox.css',
|
||||||
|
fontawesomeCss: 'https://cdn.jsdmirror.com/npm/@fortawesome/fontawesome-free@6.7.2/css/all.min.css',
|
||||||
|
instantsearchJs: 'https://cdn.jsdmirror.com/npm/instantsearch.js@4.56.0',
|
||||||
|
typesenseAdapterJs: 'https://cdn.jsdmirror.com/npm/typesense-instantsearch-adapter@2.7.0/dist/typesense-instantsearch-adapter.min.js',
|
||||||
|
fancyboxJs: 'https://cdn.jsdmirror.com/npm/@fancyapps/ui@5.0/dist/fancybox/fancybox.umd.js',
|
||||||
|
jqueryJs: 'https://code.jquery.com/jquery-4.0.0.min.js',
|
||||||
|
welcomeMessageJs: 'https://cdn.jsdmirror.com/gh/bishshi/welcomemessage/txmap.js',
|
||||||
|
},
|
||||||
|
friends: [
|
||||||
|
{
|
||||||
|
name: 'GitHub',
|
||||||
|
url: 'https://github.com/bishshi',
|
||||||
|
avatar: '/images/Bi.ico',
|
||||||
|
description: '站长的 GitHub 主页',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
export const publicSiteConfig = {
|
||||||
|
site: siteConfig.site,
|
||||||
|
author: siteConfig.author,
|
||||||
|
comments: siteConfig.comments,
|
||||||
|
talks: siteConfig.talks,
|
||||||
|
search: siteConfig.search,
|
||||||
|
externalLinks: siteConfig.externalLinks,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default siteConfig;
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
import { getCategoryHref, type BlogPost } from '@/lib/posts';
|
import { getCategoryHref, type BlogPost } from '@/lib/posts';
|
||||||
|
import { siteConfig } from '../../site.config.mjs';
|
||||||
|
|
||||||
type TocItem = {
|
type TocItem = {
|
||||||
depth: number;
|
depth: number;
|
||||||
@@ -19,7 +20,7 @@ interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const { post, toc, relatedPosts } = Astro.props;
|
const { post, toc, relatedPosts } = Astro.props;
|
||||||
const avatar = 'https://free.picui.cn/free/2025/08/10/689845496a283.png';
|
const avatar = siteConfig.author.avatar;
|
||||||
const topDepth = toc.length > 0 ? Math.min(...toc.map((item) => item.depth)) : 1;
|
const topDepth = toc.length > 0 ? Math.min(...toc.map((item) => item.depth)) : 1;
|
||||||
const tocSections = toc.reduce<TocSection[]>((sections, item) => {
|
const tocSections = toc.reduce<TocSection[]>((sections, item) => {
|
||||||
if (item.depth <= topDepth || sections.length === 0) {
|
if (item.depth <= topDepth || sections.length === 0) {
|
||||||
@@ -34,8 +35,8 @@ const tocSections = toc.reduce<TocSection[]>((sections, item) => {
|
|||||||
|
|
||||||
<aside class="article-sidebar" aria-label="文章侧边栏">
|
<aside class="article-sidebar" aria-label="文章侧边栏">
|
||||||
<section class="sidebar-card article-author-card">
|
<section class="sidebar-card article-author-card">
|
||||||
<img class="profile-avatar" src={avatar} alt="biss" loading="lazy" />
|
<img class="profile-avatar" src={avatar} alt={siteConfig.author.name} loading="lazy" />
|
||||||
<div class="profile-name">biss</div>
|
<div class="profile-name">{siteConfig.author.name}</div>
|
||||||
<div class="article-author-meta">
|
<div class="article-author-meta">
|
||||||
<span>{post.dateText}</span>
|
<span>{post.dateText}</span>
|
||||||
{post.categories[0] && <a href={getCategoryHref(post.categories[0])}>{post.categories[0]}</a>}
|
{post.categories[0] && <a href={getCategoryHref(post.categories[0])}>{post.categories[0]}</a>}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
import type { BlogPost } from '@/lib/posts';
|
import type { BlogPost } from '@/lib/posts';
|
||||||
|
import { siteConfig } from '../../site.config.mjs';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
posts: BlogPost[];
|
posts: BlogPost[];
|
||||||
@@ -8,14 +9,14 @@ interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const { posts, tags, categories } = Astro.props;
|
const { posts, tags, categories } = Astro.props;
|
||||||
const avatar = 'https://free.picui.cn/free/2025/08/10/689845496a283.png';
|
const avatar = siteConfig.author.avatar;
|
||||||
const recentPosts = posts.slice(0, 5);
|
const recentPosts = posts.slice(0, 5);
|
||||||
---
|
---
|
||||||
|
|
||||||
<aside class="home-sidebar" aria-label="首页侧边栏">
|
<aside class="home-sidebar" aria-label="首页侧边栏">
|
||||||
<section class="sidebar-card profile-card">
|
<section class="sidebar-card profile-card">
|
||||||
<img class="profile-avatar" src={avatar} alt="biss" loading="lazy" />
|
<img class="profile-avatar" src={avatar} alt={siteConfig.author.name} loading="lazy" />
|
||||||
<div class="profile-name">biss</div>
|
<div class="profile-name">{siteConfig.author.name}</div>
|
||||||
<div class="profile-stats">
|
<div class="profile-stats">
|
||||||
<a href="/archives/">
|
<a href="/archives/">
|
||||||
<span>文章</span>
|
<span>文章</span>
|
||||||
@@ -30,13 +31,13 @@ const recentPosts = posts.slice(0, 5);
|
|||||||
<strong>{categories.length}</strong>
|
<strong>{categories.length}</strong>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<a class="follow-button" href="https://github.com/bishshi" target="_blank" rel="noreferrer">
|
<a class="follow-button" href={siteConfig.author.github} target="_blank" rel="noreferrer">
|
||||||
<span class="github-mark" aria-hidden="true">GitHub</span>
|
<span class="github-mark" aria-hidden="true">GitHub</span>
|
||||||
<span>Follow Me</span>
|
<span>Follow Me</span>
|
||||||
</a>
|
</a>
|
||||||
<div class="profile-links" aria-label="联系方式">
|
<div class="profile-links" aria-label="联系方式">
|
||||||
<a href="https://github.com/bishshi" target="_blank" rel="noreferrer" aria-label="GitHub">GitHub</a>
|
<a href={siteConfig.author.github} target="_blank" rel="noreferrer" aria-label="GitHub">GitHub</a>
|
||||||
<a href="mailto:bishsh2006@gmail.com" aria-label="Email">Email</a>
|
<a href={`mailto:${siteConfig.author.email}`} aria-label="Email">Email</a>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -204,6 +205,6 @@ const recentPosts = posts.slice(0, 5);
|
|||||||
initSidebar();
|
initSidebar();
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
<script is:inline src="https://code.jquery.com/jquery-4.0.0.min.js"></script>
|
<script is:inline src={siteConfig.cdn.jqueryJs}></script>
|
||||||
<script is:inline src="https://cdn.jsdmirror.com/gh/bishshi/welcomemessage/txmap.js"></script>
|
<script is:inline src={siteConfig.cdn.welcomeMessageJs}></script>
|
||||||
<script is:inline src="/js/weather.js"></script>
|
<script is:inline src="/js/weather.js"></script>
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
---
|
---
|
||||||
|
import { siteConfig } from '../../site.config.mjs';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
title: string;
|
title: string;
|
||||||
subtitle?: string;
|
subtitle?: string;
|
||||||
@@ -8,7 +10,7 @@ const { title, subtitle } = Astro.props;
|
|||||||
---
|
---
|
||||||
|
|
||||||
<header class="page-header-card">
|
<header class="page-header-card">
|
||||||
<p class="page-header-eyebrow">Bi's Blog</p>
|
<p class="page-header-eyebrow">{siteConfig.site.name}</p>
|
||||||
<h1>{title}</h1>
|
<h1>{title}</h1>
|
||||||
{subtitle && <p class="page-header-subtitle">{subtitle}</p>}
|
{subtitle && <p class="page-header-subtitle">{subtitle}</p>}
|
||||||
</header>
|
</header>
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
---
|
---
|
||||||
|
import { siteConfig } from '../../site.config.mjs';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
envId: string;
|
envId: string;
|
||||||
path: string;
|
path: string;
|
||||||
@@ -16,6 +18,7 @@ const { envId, path, title, region = '' } = Astro.props;
|
|||||||
data-env-id={envId}
|
data-env-id={envId}
|
||||||
data-region={region}
|
data-region={region}
|
||||||
data-path={path}
|
data-path={path}
|
||||||
|
data-script={siteConfig.comments.script}
|
||||||
>
|
>
|
||||||
<div class="twikoo-comments-head">
|
<div class="twikoo-comments-head">
|
||||||
<span class="twikoo-comments-icon" aria-hidden="true">
|
<span class="twikoo-comments-icon" aria-hidden="true">
|
||||||
@@ -61,7 +64,7 @@ const { envId, path, title, region = '' } = Astro.props;
|
|||||||
}
|
}
|
||||||
|
|
||||||
const script = document.createElement('script');
|
const script = document.createElement('script');
|
||||||
script.src = 'https://cdn.jsdelivr.net/npm/twikoo@1.7.7/dist/twikoo.min.js';
|
script.src = root.dataset.script;
|
||||||
script.defer = true;
|
script.defer = true;
|
||||||
script.onload = initTwikoo;
|
script.onload = initTwikoo;
|
||||||
script.onerror = () => {
|
script.onerror = () => {
|
||||||
|
|||||||
Vendored
+7
@@ -1,2 +1,9 @@
|
|||||||
/// <reference path="../.astro/types.d.ts" />
|
/// <reference path="../.astro/types.d.ts" />
|
||||||
/// <reference types="astro/client" />
|
/// <reference types="astro/client" />
|
||||||
|
|
||||||
|
declare module '*.mjs' {
|
||||||
|
export const siteConfig: any;
|
||||||
|
export const publicSiteConfig: any;
|
||||||
|
const value: any;
|
||||||
|
export default value;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,24 +1,27 @@
|
|||||||
---
|
---
|
||||||
import '../styles/site.css';
|
import '../styles/site.css';
|
||||||
|
import { publicSiteConfig, siteConfig } from '../../site.config.mjs';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
title?: string;
|
title?: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const siteTitle = "Bi's Blog";
|
const siteTitle = siteConfig.site.name;
|
||||||
const { title = siteTitle, description = 'Personal blog by biss.' } = Astro.props;
|
const { title = siteTitle, description = siteConfig.site.description } = Astro.props;
|
||||||
const pageTitle = title === siteTitle ? siteTitle : `${title} | ${siteTitle}`;
|
const pageTitle = title === siteTitle ? siteTitle : `${title} | ${siteTitle}`;
|
||||||
const currentYear = new Date().getFullYear();
|
const currentYear = new Date().getFullYear();
|
||||||
|
const publicConfigJson = JSON.stringify(publicSiteConfig).replace(/</g, '\\u003c');
|
||||||
---
|
---
|
||||||
|
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="zh-CN">
|
<html lang={siteConfig.site.language}>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<meta name="description" content={description} />
|
<meta name="description" content={description} />
|
||||||
<link rel="icon" href="/images/Bi.ico" />
|
<link rel="icon" href={siteConfig.assets.icon} />
|
||||||
|
<script is:inline set:html={`window.SITE_CONFIG = ${publicConfigJson};`}></script>
|
||||||
<script is:inline>
|
<script is:inline>
|
||||||
(() => {
|
(() => {
|
||||||
const storageKey = 'site-theme';
|
const storageKey = 'site-theme';
|
||||||
@@ -27,22 +30,19 @@ const currentYear = new Date().getFullYear();
|
|||||||
document.documentElement.dataset.theme = savedTheme || systemTheme;
|
document.documentElement.dataset.theme = savedTheme || systemTheme;
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
<link rel="stylesheet" href="https://cdn.jsdmirror.com/npm/instantsearch.css/themes/reset-min.css" />
|
<link rel="stylesheet" href={siteConfig.cdn.instantsearchCss} />
|
||||||
<link rel="stylesheet" href="https://cdn.jsdmirror.com/npm/@fancyapps/ui@5.0/dist/fancybox/fancybox.css" />
|
<link rel="stylesheet" href={siteConfig.cdn.fancyboxCss} />
|
||||||
<link rel="stylesheet" href="https://cdn.jsdmirror.com/npm/@fortawesome/fontawesome-free@6.7.2/css/all.min.css" />
|
<link rel="stylesheet" href={siteConfig.cdn.fontawesomeCss} />
|
||||||
<title>{pageTitle}</title>
|
<title>{pageTitle}</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header class="site-header">
|
<header class="site-header">
|
||||||
<nav class="nav">
|
<nav class="nav">
|
||||||
<a class="brand" href="/">Bi's Blog</a>
|
<a class="brand" href="/">{siteConfig.site.name}</a>
|
||||||
<div class="nav-links nav-center">
|
<div class="nav-links nav-center">
|
||||||
<a href="/archives/"><i class="fa-solid fa-box-archive nav-icon" aria-hidden="true"></i><span>归档</span></a>
|
{siteConfig.nav.map((item) => (
|
||||||
<a href="/categories/"><i class="fa-solid fa-folder-open nav-icon" aria-hidden="true"></i><span>分类</span></a>
|
<a href={item.href}><i class={`${item.icon} nav-icon`} aria-hidden="true"></i><span>{item.label}</span></a>
|
||||||
<a href="/tags/"><i class="fa-solid fa-tags nav-icon" aria-hidden="true"></i><span>标签</span></a>
|
))}
|
||||||
<a href="/shuoshuo/"><i class="fa-regular fa-comments nav-icon" aria-hidden="true"></i><span>说说</span></a>
|
|
||||||
<a href="/about/"><i class="fa-solid fa-heart nav-icon" aria-hidden="true"></i><span>关于</span></a>
|
|
||||||
<a href="/link/"><i class="fa-solid fa-link nav-icon" aria-hidden="true"></i><span>友链</span></a>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="nav-links nav-actions">
|
<div class="nav-links nav-actions">
|
||||||
<button class="nav-random" type="button" onclick="randomPost()" aria-label="前往随机文章" title="前往随机文章">
|
<button class="nav-random" type="button" onclick="randomPost()" aria-label="前往随机文章" title="前往随机文章">
|
||||||
@@ -66,52 +66,54 @@ const currentYear = new Date().getFullYear();
|
|||||||
<footer class="site-footer" aria-label="站点页脚">
|
<footer class="site-footer" aria-label="站点页脚">
|
||||||
<div class="footer-inner">
|
<div class="footer-inner">
|
||||||
<section class="footer-top" aria-label="站点信息">
|
<section class="footer-top" aria-label="站点信息">
|
||||||
<a class="footer-brand" href="/" aria-label="Bi's Blog 首页">
|
<a class="footer-brand" href="/" aria-label={`${siteConfig.site.name} 首页`}>
|
||||||
<img src="/images/Bi.ico" alt="" loading="lazy" />
|
<img src={siteConfig.assets.icon} alt="" loading="lazy" />
|
||||||
<span>Bi's Blog</span>
|
<span>{siteConfig.site.name}</span>
|
||||||
</a>
|
</a>
|
||||||
<p class="footer-slogan">好奇心转化为代码的空间。</p>
|
<p class="footer-slogan">{siteConfig.site.slogan}</p>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="footer-contact" aria-label="联系方式">
|
<section class="footer-contact" aria-label="联系方式">
|
||||||
<p>联系方式</p>
|
<p>{siteConfig.footer.contactLabel}</p>
|
||||||
<div class="footer-socials">
|
<div class="footer-socials">
|
||||||
<a href="mailto:bishsh2006@gmail.com" aria-label="发送邮件" title="发送邮件">
|
{siteConfig.social.map((item) => (
|
||||||
<i class="fa-solid fa-envelope" aria-hidden="true"></i>
|
<a href={item.href} target={item.external ? '_blank' : undefined} rel={item.external ? 'noreferrer' : undefined} aria-label={item.label} title={item.label}>
|
||||||
</a>
|
<i class={item.icon} aria-hidden="true"></i>
|
||||||
<a href="/rss.xml" aria-label="订阅 RSS" title="订阅 RSS">
|
|
||||||
<i class="fa-solid fa-rss" aria-hidden="true"></i>
|
|
||||||
</a>
|
|
||||||
<a href="https://github.com/bishshi" target="_blank" rel="noreferrer" aria-label="GitHub" title="GitHub">
|
|
||||||
<i class="fa-brands fa-github" aria-hidden="true"></i>
|
|
||||||
</a>
|
</a>
|
||||||
|
))}
|
||||||
</div>
|
</div>
|
||||||
<nav class="footer-contact-links" aria-label="页脚链接">
|
<nav class="footer-contact-links" aria-label="页脚链接">
|
||||||
<a href="/archives/">发展历程</a>
|
{siteConfig.footer.links.map((item, index) => (
|
||||||
<span aria-hidden="true">|</span>
|
<>
|
||||||
<a href="/privacy/">隐私政策</a>
|
{index > 0 && <span aria-hidden="true">|</span>}
|
||||||
|
<a href={item.href}>{item.label}</a>
|
||||||
|
</>
|
||||||
|
))}
|
||||||
</nav>
|
</nav>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="footer-bottom" aria-label="版权信息">
|
<section class="footer-bottom" aria-label="版权信息">
|
||||||
<div>
|
<div>
|
||||||
<p>© 2025 - {currentYear} Bi's Blog</p>
|
<p>© {siteConfig.site.copyrightStartYear} - {currentYear} {siteConfig.site.name}</p>
|
||||||
<p>blog.biss.click | 内容采用 CC BY-NC-SA 4.0 协议</p>
|
<p>{siteConfig.site.domain} | {siteConfig.site.license}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="footer-meta">
|
<div class="footer-meta">
|
||||||
<p>本站已苟活:<span id="site-runtime">计算中...</span></p>
|
<p>本站已苟活:<span id="site-runtime">计算中...</span></p>
|
||||||
<p>
|
<p>
|
||||||
<a href="https://edgeone.ai/" target="_blank" rel="noreferrer">EdgeOne</a>
|
{siteConfig.footer.poweredBy.map((item, index) => (
|
||||||
<span aria-hidden="true">|</span>
|
<>
|
||||||
<a href="https://astro.build/" target="_blank" rel="noreferrer">ASTRO</a>
|
{index > 0 && <span aria-hidden="true">|</span>}
|
||||||
|
<a href={item.href} target="_blank" rel="noreferrer">{item.label}</a>
|
||||||
|
</>
|
||||||
|
))}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
<script is:inline src="https://cdn.jsdmirror.com/npm/instantsearch.js@4.56.0"></script>
|
<script is:inline src={siteConfig.cdn.instantsearchJs}></script>
|
||||||
<script is:inline src="https://cdn.jsdmirror.com/npm/typesense-instantsearch-adapter@2.7.0/dist/typesense-instantsearch-adapter.min.js"></script>
|
<script is:inline src={siteConfig.cdn.typesenseAdapterJs}></script>
|
||||||
<script is:inline src="https://cdn.jsdmirror.com/npm/@fancyapps/ui@5.0/dist/fancybox/fancybox.umd.js"></script>
|
<script is:inline src={siteConfig.cdn.fancyboxJs}></script>
|
||||||
<script is:inline src="/js/random.js"></script>
|
<script is:inline src="/js/random.js"></script>
|
||||||
<script is:inline src="/js/search/typesense-search.js"></script>
|
<script is:inline src="/js/search/typesense-search.js"></script>
|
||||||
<script is:inline src="/js/external-links.js"></script>
|
<script is:inline src="/js/external-links.js"></script>
|
||||||
@@ -147,7 +149,7 @@ const currentYear = new Date().getFullYear();
|
|||||||
const runtime = document.getElementById('site-runtime');
|
const runtime = document.getElementById('site-runtime');
|
||||||
if (!runtime) return;
|
if (!runtime) return;
|
||||||
|
|
||||||
const start = new Date('2025-01-01T00:00:00+08:00').getTime();
|
const start = new Date(window.SITE_CONFIG.site.startTime).getTime();
|
||||||
const pad = (value) => String(value).padStart(2, '0');
|
const pad = (value) => String(value).padStart(2, '0');
|
||||||
|
|
||||||
function updateRuntime() {
|
function updateRuntime() {
|
||||||
|
|||||||
@@ -1,11 +1,4 @@
|
|||||||
export const externalLinkWhitelist = [
|
import { siteConfig } from '../../site.config.mjs';
|
||||||
'blog.biss.click',
|
|
||||||
'biss.click',
|
|
||||||
'github.com',
|
|
||||||
'astro.build',
|
|
||||||
'edgeone.ai',
|
|
||||||
'localhost',
|
|
||||||
'127.0.0.1',
|
|
||||||
];
|
|
||||||
|
|
||||||
export const externalLinkWaitSeconds = 10;
|
export const externalLinkWhitelist = siteConfig.externalLinks.whitelist;
|
||||||
|
export const externalLinkWaitSeconds = siteConfig.externalLinks.waitSeconds;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
export const POSTS_PER_PAGE = 16;
|
import { siteConfig } from '../../site.config.mjs';
|
||||||
|
|
||||||
|
export const POSTS_PER_PAGE = siteConfig.pagination.postsPerPage;
|
||||||
|
|
||||||
export type PageSlice<T> = {
|
export type PageSlice<T> = {
|
||||||
currentPage: number;
|
currentPage: number;
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
---
|
---
|
||||||
import BaseLayout from '@/layouts/BaseLayout.astro';
|
import BaseLayout from '@/layouts/BaseLayout.astro';
|
||||||
import PageHeaderCard from '@/components/PageHeaderCard.astro';
|
import PageHeaderCard from '@/components/PageHeaderCard.astro';
|
||||||
|
import { siteConfig } from '../../site.config.mjs';
|
||||||
---
|
---
|
||||||
|
|
||||||
<BaseLayout title="关于" description="关于 Bi's Blog 和站长 Bi 的简短介绍。">
|
<BaseLayout title="关于" description={`关于 ${siteConfig.site.name} 和站长 ${siteConfig.author.name} 的简短介绍。`}>
|
||||||
<section class="content-wrap narrow page-with-card native-page">
|
<section class="content-wrap narrow page-with-card native-page">
|
||||||
<PageHeaderCard title="关于" subtitle="这里记录折腾、学习和一些普通日子的回声。" />
|
<PageHeaderCard title="关于" subtitle="这里记录折腾、学习和一些普通日子的回声。" />
|
||||||
</section>
|
</section>
|
||||||
@@ -35,9 +36,9 @@ import PageHeaderCard from '@/components/PageHeaderCard.astro';
|
|||||||
<h2>联系</h2>
|
<h2>联系</h2>
|
||||||
<p>
|
<p>
|
||||||
如果你想交流文章内容、友链或网站相关问题,可以通过
|
如果你想交流文章内容、友链或网站相关问题,可以通过
|
||||||
<a href="mailto:bishsh2006@gmail.com">bishsh2006@gmail.com</a>
|
<a href={`mailto:${siteConfig.author.email}`}>{siteConfig.author.email}</a>
|
||||||
联系我,也可以去
|
联系我,也可以去
|
||||||
<a href="https://github.com/bishshi" target="_blank" rel="noreferrer">GitHub</a>
|
<a href={siteConfig.author.github} target="_blank" rel="noreferrer">GitHub</a>
|
||||||
找到我。
|
找到我。
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+2
-1
@@ -1,9 +1,10 @@
|
|||||||
---
|
---
|
||||||
import BaseLayout from '@/layouts/BaseLayout.astro';
|
import BaseLayout from '@/layouts/BaseLayout.astro';
|
||||||
import PageHeaderCard from '@/components/PageHeaderCard.astro';
|
import PageHeaderCard from '@/components/PageHeaderCard.astro';
|
||||||
|
import { siteConfig } from '../../site.config.mjs';
|
||||||
---
|
---
|
||||||
|
|
||||||
<BaseLayout title="版权协议" description="Bi's Blog 的内容版权与转载说明。">
|
<BaseLayout title="版权协议" description={`${siteConfig.site.name} 的内容版权与转载说明。`}>
|
||||||
<section class="content-wrap narrow page-with-card native-page">
|
<section class="content-wrap narrow page-with-card native-page">
|
||||||
<PageHeaderCard title="版权协议" subtitle="关于本站原创内容的转载、引用和使用方式。" />
|
<PageHeaderCard title="版权协议" subtitle="关于本站原创内容的转载、引用和使用方式。" />
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
---
|
---
|
||||||
import BaseLayout from '@/layouts/BaseLayout.astro';
|
import BaseLayout from '@/layouts/BaseLayout.astro';
|
||||||
import PageHeaderCard from '@/components/PageHeaderCard.astro';
|
import PageHeaderCard from '@/components/PageHeaderCard.astro';
|
||||||
|
import { siteConfig } from '../../site.config.mjs';
|
||||||
---
|
---
|
||||||
|
|
||||||
<BaseLayout title="Cookies" description="Bi's Blog 的 Cookie 与本地存储说明。">
|
<BaseLayout title="Cookies" description={`${siteConfig.site.name} 的 Cookie 与本地存储说明。`}>
|
||||||
<section class="content-wrap narrow page-with-card native-page">
|
<section class="content-wrap narrow page-with-card native-page">
|
||||||
<PageHeaderCard title="Cookies" subtitle="说明本站如何使用 Cookie 与浏览器本地存储。" />
|
<PageHeaderCard title="Cookies" subtitle="说明本站如何使用 Cookie 与浏览器本地存储。" />
|
||||||
</section>
|
</section>
|
||||||
@@ -56,7 +57,7 @@ import PageHeaderCard from '@/components/PageHeaderCard.astro';
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h2>联系</h2>
|
<h2>联系</h2>
|
||||||
<p>如果你对 Cookie 使用方式有疑问,可以发送邮件至 <a href="mailto:bishsh2006@gmail.com">bishsh2006@gmail.com</a>。</p>
|
<p>如果你对 Cookie 使用方式有疑问,可以发送邮件至 <a href={`mailto:${siteConfig.author.email}`}>{siteConfig.author.email}</a>。</p>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
</BaseLayout>
|
</BaseLayout>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import HomeSidebar from '@/components/HomeSidebar.astro';
|
|||||||
import PostCard from '@/components/PostCard.astro';
|
import PostCard from '@/components/PostCard.astro';
|
||||||
import { getAllCategories, getAllPosts, getAllTags } from '@/lib/posts';
|
import { getAllCategories, getAllPosts, getAllTags } from '@/lib/posts';
|
||||||
import { getPageSlice } from '@/lib/pagination';
|
import { getPageSlice } from '@/lib/pagination';
|
||||||
|
import { siteConfig } from '../../site.config.mjs';
|
||||||
|
|
||||||
const posts = await getAllPosts();
|
const posts = await getAllPosts();
|
||||||
const tags = await getAllTags();
|
const tags = await getAllTags();
|
||||||
@@ -16,7 +17,7 @@ const pageData = getPageSlice(posts, 1);
|
|||||||
<section class="hero">
|
<section class="hero">
|
||||||
<div>
|
<div>
|
||||||
<p class="eyebrow">写给日常、技术和正在发生的自己</p>
|
<p class="eyebrow">写给日常、技术和正在发生的自己</p>
|
||||||
<h1>Bi's Blog</h1>
|
<h1>{siteConfig.site.name}</h1>
|
||||||
<p>把折腾、学习和生活片段安静地收在这里。</p>
|
<p>把折腾、学习和生活片段安静地收在这里。</p>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
+7
-13
@@ -1,18 +1,12 @@
|
|||||||
---
|
---
|
||||||
import BaseLayout from '@/layouts/BaseLayout.astro';
|
import BaseLayout from '@/layouts/BaseLayout.astro';
|
||||||
import PageHeaderCard from '@/components/PageHeaderCard.astro';
|
import PageHeaderCard from '@/components/PageHeaderCard.astro';
|
||||||
|
import { siteConfig } from '../../site.config.mjs';
|
||||||
|
|
||||||
const friends = [
|
const friends = siteConfig.friends;
|
||||||
{
|
|
||||||
name: 'GitHub',
|
|
||||||
url: 'https://github.com/bishshi',
|
|
||||||
avatar: '/images/Bi.ico',
|
|
||||||
description: '站长的 GitHub 主页',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<BaseLayout title="友情链接" description="Bi's Blog 的友情链接页面。">
|
<BaseLayout title="友情链接" description={`${siteConfig.site.name} 的友情链接页面。`}>
|
||||||
<section class="content-wrap narrow native-page">
|
<section class="content-wrap narrow native-page">
|
||||||
<PageHeaderCard title="友情链接" subtitle="把仍在发光的角落放在一起。" />
|
<PageHeaderCard title="友情链接" subtitle="把仍在发光的角落放在一起。" />
|
||||||
|
|
||||||
@@ -36,10 +30,10 @@ const friends = [
|
|||||||
欢迎长期维护、内容原创、访问稳定的个人站点交换友链。你可以通过邮件发送站点名称、地址、头像和一句简介。
|
欢迎长期维护、内容原创、访问稳定的个人站点交换友链。你可以通过邮件发送站点名称、地址、头像和一句简介。
|
||||||
</p>
|
</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>站点名称:Bi's Blog</li>
|
<li>站点名称:{siteConfig.site.name}</li>
|
||||||
<li>站点地址:https://blog.biss.click/</li>
|
<li>站点地址:{siteConfig.site.url}/</li>
|
||||||
<li>头像地址:https://blog.biss.click/images/Bi.ico</li>
|
<li>头像地址:{siteConfig.site.url}{siteConfig.assets.icon}</li>
|
||||||
<li>站点简介:好奇心转化为代码的空间。</li>
|
<li>站点简介:{siteConfig.site.slogan}</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import PostCard from '@/components/PostCard.astro';
|
|||||||
import BaseLayout from '@/layouts/BaseLayout.astro';
|
import BaseLayout from '@/layouts/BaseLayout.astro';
|
||||||
import { getAllCategories, getAllPosts, getAllTags } from '@/lib/posts';
|
import { getAllCategories, getAllPosts, getAllTags } from '@/lib/posts';
|
||||||
import { getPageSlice, getPaginationPaths } from '@/lib/pagination';
|
import { getPageSlice, getPaginationPaths } from '@/lib/pagination';
|
||||||
|
import { siteConfig } from '../../../site.config.mjs';
|
||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function getStaticPaths() {
|
||||||
const posts = await getAllPosts();
|
const posts = await getAllPosts();
|
||||||
@@ -26,7 +27,7 @@ const pageData = getPageSlice(posts, page);
|
|||||||
<section class="hero compact-hero">
|
<section class="hero compact-hero">
|
||||||
<div>
|
<div>
|
||||||
<p class="eyebrow">写给日常、技术和正在发生的自己</p>
|
<p class="eyebrow">写给日常、技术和正在发生的自己</p>
|
||||||
<h1>Bi's Blog</h1>
|
<h1>{siteConfig.site.name}</h1>
|
||||||
<p>第 {pageData.currentPage} 页,继续翻看最近的记录。</p>
|
<p>第 {pageData.currentPage} 页,继续翻看最近的记录。</p>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import TwikooComments from '@/components/TwikooComments.astro';
|
|||||||
import BaseLayout from '@/layouts/BaseLayout.astro';
|
import BaseLayout from '@/layouts/BaseLayout.astro';
|
||||||
import { render } from 'astro:content';
|
import { render } from 'astro:content';
|
||||||
import { getAllPosts, getCategoryHref } from '@/lib/posts';
|
import { getAllPosts, getCategoryHref } from '@/lib/posts';
|
||||||
|
import { siteConfig } from '../../../site.config.mjs';
|
||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function getStaticPaths() {
|
||||||
return (await getAllPosts()).map((post) => ({
|
return (await getAllPosts()).map((post) => ({
|
||||||
@@ -75,7 +76,6 @@ const relatedPosts = allPosts
|
|||||||
.filter((item) => item.slug !== post.slug)
|
.filter((item) => item.slug !== post.slug)
|
||||||
.filter((item) => item.categories.some((category) => post.categories.includes(category)))
|
.filter((item) => item.categories.some((category) => post.categories.includes(category)))
|
||||||
.slice(0, 8);
|
.slice(0, 8);
|
||||||
const twikooEnvId = 'https://comment.biss.click';
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<BaseLayout title={post.title} description={post.summary}>
|
<BaseLayout title={post.title} description={post.summary}>
|
||||||
@@ -125,7 +125,7 @@ const twikooEnvId = 'https://comment.biss.click';
|
|||||||
<Content />
|
<Content />
|
||||||
</div>
|
</div>
|
||||||
<PostCopyrightCard post={post} />
|
<PostCopyrightCard post={post} />
|
||||||
{post.comments && <TwikooComments envId={twikooEnvId} path={post.href} title={post.title} />}
|
{post.comments && <TwikooComments envId={siteConfig.comments.envId} region={siteConfig.comments.region} path={post.href} title={post.title} />}
|
||||||
</article>
|
</article>
|
||||||
<ArticleSidebar post={post} toc={toc} relatedPosts={relatedPosts} />
|
<ArticleSidebar post={post} toc={toc} relatedPosts={relatedPosts} />
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
---
|
---
|
||||||
import BaseLayout from '@/layouts/BaseLayout.astro';
|
import BaseLayout from '@/layouts/BaseLayout.astro';
|
||||||
import PageHeaderCard from '@/components/PageHeaderCard.astro';
|
import PageHeaderCard from '@/components/PageHeaderCard.astro';
|
||||||
|
import { siteConfig } from '../../site.config.mjs';
|
||||||
---
|
---
|
||||||
|
|
||||||
<BaseLayout title="隐私政策" description="Bi's Blog 的隐私与数据处理说明。">
|
<BaseLayout title="隐私政策" description={`${siteConfig.site.name} 的隐私与数据处理说明。`}>
|
||||||
<section class="content-wrap narrow page-with-card native-page">
|
<section class="content-wrap narrow page-with-card native-page">
|
||||||
<PageHeaderCard title="隐私政策" subtitle="说明访问本站时可能涉及的数据收集与使用方式。" />
|
<PageHeaderCard title="隐私政策" subtitle="说明访问本站时可能涉及的数据收集与使用方式。" />
|
||||||
</section>
|
</section>
|
||||||
@@ -41,7 +42,7 @@ import PageHeaderCard from '@/components/PageHeaderCard.astro';
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h2>联系</h2>
|
<h2>联系</h2>
|
||||||
<p>如果你希望删除评论或询问隐私相关问题,可以发送邮件至 <a href="mailto:bishsh2006@gmail.com">bishsh2006@gmail.com</a>。</p>
|
<p>如果你希望删除评论或询问隐私相关问题,可以发送邮件至 <a href={`mailto:${siteConfig.author.email}`}>{siteConfig.author.email}</a>。</p>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
</BaseLayout>
|
</BaseLayout>
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
import rss from '@astrojs/rss';
|
import rss from '@astrojs/rss';
|
||||||
import { getAllPosts } from '@/lib/posts';
|
import { getAllPosts } from '@/lib/posts';
|
||||||
|
import { siteConfig } from '../../site.config.mjs';
|
||||||
|
|
||||||
export async function GET(context) {
|
export async function GET(context) {
|
||||||
const posts = await getAllPosts();
|
const posts = await getAllPosts();
|
||||||
|
|
||||||
return rss({
|
return rss({
|
||||||
title: "Bi's Blog",
|
title: siteConfig.site.name,
|
||||||
description: 'Personal blog by biss.',
|
description: siteConfig.site.description,
|
||||||
site: context.site,
|
site: context.site,
|
||||||
items: posts.map((post) => ({
|
items: posts.map((post) => ({
|
||||||
title: post.title,
|
title: post.title,
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
import BaseLayout from '@/layouts/BaseLayout.astro';
|
import BaseLayout from '@/layouts/BaseLayout.astro';
|
||||||
import PageHeaderCard from '@/components/PageHeaderCard.astro';
|
import PageHeaderCard from '@/components/PageHeaderCard.astro';
|
||||||
import TwikooComments from '@/components/TwikooComments.astro';
|
import TwikooComments from '@/components/TwikooComments.astro';
|
||||||
|
import { siteConfig } from '../../site.config.mjs';
|
||||||
|
|
||||||
const title = '说说';
|
const title = '说说';
|
||||||
const twikooEnvId = 'https://comment.biss.click';
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<BaseLayout title={title} description="记录日常碎片和灵感的说说页面。">
|
<BaseLayout title={title} description="记录日常碎片和灵感的说说页面。">
|
||||||
@@ -24,7 +24,7 @@ const twikooEnvId = 'https://comment.biss.click';
|
|||||||
<div class="shuoshuo-markdown prose">
|
<div class="shuoshuo-markdown prose">
|
||||||
<div id="talk"></div>
|
<div id="talk"></div>
|
||||||
</div>
|
</div>
|
||||||
<TwikooComments envId={twikooEnvId} path="/shuoshuo/" title={title} />
|
<TwikooComments envId={siteConfig.comments.envId} region={siteConfig.comments.region} path="/shuoshuo/" title={title} />
|
||||||
<script is:inline src="/js/shuoshuo.js"></script>
|
<script is:inline src="/js/shuoshuo.js"></script>
|
||||||
</section>
|
</section>
|
||||||
</BaseLayout>
|
</BaseLayout>
|
||||||
|
|||||||
Reference in New Issue
Block a user