mirror of
https://github.com/Ad-closeNN/blog-fuwari.git
synced 2026-05-31 01:00:04 -04:00
docs(pages): 增加仓库信息页 /info/
2. feat(config): banner 使用 WebP 格式图片 3. style(config): search 搜索条长度固定 4. style(profile): 将个人档案 profile 中的提交记录改为 /info/ 5. chore(profile): 将 profile 电子邮箱地址改为 admin@adclosenn.top 6. style(config): 删除了顶部 Nav 的 主页 7. docs(pages): about 关于页面更新 2025/8/16 8. style(css): 加入专对于代码框的字体 JetBrainsMono-VF 9. fix(config): 解决misans.astro 文件中的解释 description 被定义为了 I18nKey.about 关于 的问题
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 70 KiB |
@@ -146,7 +146,7 @@ $: if (initialized && keywordMobile) {
|
||||
<Icon icon="material-symbols:search" class="absolute text-[1.25rem] pointer-events-none ml-3 transition my-auto text-black/30 dark:text-white/30"></Icon>
|
||||
<input placeholder="{i18n(I18nKey.search)}" bind:value={keywordDesktop} on:focus={() => search(keywordDesktop, true)}
|
||||
class="transition-all pl-10 text-sm bg-transparent outline-0
|
||||
h-full w-40 active:w-60 focus:w-60 text-black/50 dark:text-white/50"
|
||||
h-full w-40 active:w-40 focus:w-40 text-black/50 dark:text-white/50"
|
||||
>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ const isSunday = new Date().getDay() === 0;
|
||||
<div class="text-center text-sm text-neutral-500 dark:text-neutral-400 mt-3 pt-3 border-t border-neutral-200 dark:border-neutral-700">
|
||||
<div class="flex items-center justify-center gap-1">
|
||||
<Icon name="ic:baseline-commit" class="text-base"></Icon>
|
||||
<span><a id="github-commit-link" href="#" target="_blank">
|
||||
<span><a id="github-commit-link" href="#">
|
||||
<span id="github-commit">加载中...</span></a></span>
|
||||
|
||||
</div>
|
||||
@@ -192,7 +192,8 @@ fetch("https://v1.hitokoto.cn")
|
||||
|
||||
|
||||
if (link){
|
||||
const gurl = "https://github.com/Ad-closeNN/blog-fuwari/commit/"+Data.sha;
|
||||
// const gurl = "https://github.com/Ad-closeNN/blog-fuwari/commit/"+Data.sha;
|
||||
const gurl = "/info/";
|
||||
link.href = gurl;
|
||||
link.title = "("+Data.commit.committer.date + ")" + " " + Data.commit.message;
|
||||
}
|
||||
|
||||
+7
-3
@@ -18,7 +18,7 @@ export const siteConfig: SiteConfig = {
|
||||
},
|
||||
banner: {
|
||||
enable: true,
|
||||
src: "/assets/apache_carbon.svg", // Relative to the /src directory. Relative to the /public directory if it starts with '/'
|
||||
src: "/assets/apache_carbon.webp", // Relative to the /src directory. Relative to the /public directory if it starts with '/'
|
||||
position: "center", // Equivalent to object-position, only supports 'top', 'center', 'bottom'. 'center' by default
|
||||
credit: {
|
||||
enable: true, // Display the credit text of the banner image
|
||||
@@ -55,9 +55,13 @@ export const siteConfig: SiteConfig = {
|
||||
|
||||
export const navBarConfig: NavBarConfig = {
|
||||
links: [
|
||||
LinkPreset.Home,
|
||||
LinkPreset.Archive,
|
||||
LinkPreset.About,
|
||||
{
|
||||
name: "仓库信息",
|
||||
url: "/info/", // Internal links should not include the base path, as it is automatically added
|
||||
external: false, // Show an external link icon and will open in a new tab
|
||||
},
|
||||
{
|
||||
name: "友情链接",
|
||||
url: "/friends/", // Internal links should not include the base path, as it is automatically added
|
||||
@@ -108,7 +112,7 @@ export const profileConfig: ProfileConfig = {
|
||||
{
|
||||
name: "Email",
|
||||
icon: "ic:sharp-email",
|
||||
url: "mailto:1709301095@qq.com",
|
||||
url: "mailto:admin@adclosenn.top",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -46,6 +46,9 @@ Discord:https://discord.com/users/1068060784300658688
|
||||
|
||||
---
|
||||
|
||||
# 2025/8/16
|
||||
因为 SVG 格式在没有 HarmonyOS Sans SC 字体的情况下无法正常显示这个字体(会显示为浏览器默认中文字体),所以本站使用 WebP 格式的 banner,大小 70.02 KB,相比 PNG 格式的 279.65 KB 减少了许多。
|
||||
|
||||
# 2025/8/14
|
||||
用上了大佬插件 [@rehypejs/rehype-external-links](https://www.npmjs.com/package/rehype-external-links) ,这个插件可以让仅 Markdown 文件里面定义的链接以 `target="_blank` 的形式构建。也就是通过这个插件构建出来的超链接,点击后是通过新标签页打开的。而原来原版是直接在博客里,通过覆盖你正在阅读的文章来打开链接。
|
||||
可以试试点这两个链接进行比对: [更改后](https://www.bing.com) | <a href="https://www.bing.com">更改前</a>
|
||||
@@ -65,9 +68,10 @@ the error log is like driving with your eyes closed.
|
||||
—— Apache 官方文档 Getting Started 篇章
|
||||
```
|
||||
|
||||
除此之外,我在 `/public/` 中留了 3 个 banner 文件:
|
||||
- [/public/assets/apache_carbon.svg](/assets/apache_carbon.svg) :由 [Carbon](https://github.com/carbon-app/carbon) 生成的 banner,`SVG` 格式(本站使用中)。 
|
||||
除此之外,我在 `/public/` 中留了 4 个 banner 文件:
|
||||
- [/public/assets/apache_carbon.svg](/assets/apache_carbon.svg) :由 [Carbon](https://github.com/carbon-app/carbon) 生成的 banner,`SVG` 格式。 
|
||||
- [/public/assets/apache_carbon.png](/assets/apache_carbon.png) :由 [Carbon](https://github.com/carbon-app/carbon) 生成的 banner,`PNG` 格式。
|
||||
- [/public/assets/apache_carbon.webp](/assets/apache_carbon.webp) :由 [Carbon](https://github.com/carbon-app/carbon) 生成的 banner,`WebP` 格式。(本站使用中)
|
||||
- [/public/assets/apache.jpg](/assets/apache.jpg):网传的图片 
|
||||
|
||||
和一个 `JSON` 文件:
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
# 信息/提交记录
|
||||
## 概览
|
||||
当前提交:
|
||||
<span>
|
||||
<a id="github-commit-link2" href="#" target="_blank">
|
||||
<span id="github-commit2">加载中...</span>
|
||||
</a>
|
||||
</span>
|
||||
<br>
|
||||
提交哈希:<code id="github-commit-full-hash">加载中...</code>
|
||||
<br>
|
||||
提交详情:<code id="github-commit-message">加载中...</code>
|
||||
<br>
|
||||
提交者:
|
||||
<span>
|
||||
<a id="github-commit-author-link" href="#" target="_blank">
|
||||
<span id="github-commit-author">加载中...</span>
|
||||
</a>
|
||||
</span>
|
||||
<br>
|
||||
提交日期:<span id="github-commit-date">加载中...</span>
|
||||
<br>
|
||||
|
||||
## 完整提交记录
|
||||
<pre id="github-commit-full">加载中...</pre>
|
||||
|
||||
|
||||
<script>
|
||||
async function loadCommitStats2() {
|
||||
try {
|
||||
// 第零步:检查域名(甚至本地)
|
||||
const statsElement = document.getElementById('github-commit2'); // 查找 id
|
||||
const link = document.getElementById('github-commit-link2'); // 查找 id
|
||||
|
||||
const hashElement = document.getElementById('github-commit-hash'); // 查找 id
|
||||
const fullHashElement = document.getElementById('github-commit-full-hash'); // 查找 id
|
||||
const messageElement = document.getElementById('github-commit-message'); // 查找 id
|
||||
const authorElement = document.getElementById('github-commit-author'); // 查找 id
|
||||
const dateElement = document.getElementById('github-commit-date'); // 查找 id
|
||||
const urlElement = document.getElementById('github-commit-url'); // 查找 id
|
||||
const authorElementUrl = document.getElementById('github-commit-author-link'); // 查找 id
|
||||
const fullElement = document.getElementById('github-commit-full'); // 查找 id
|
||||
|
||||
if (!window.location.hostname.includes('localhost') && !window.location.hostname.includes('adclosenn.top')) {
|
||||
statsElement.textContent = 'Err. invalid domain name';
|
||||
}
|
||||
// 第一步:调用 API
|
||||
const githubResponse = await fetch(`https://api.adclosenn.top/.netlify/functions/commit`);
|
||||
|
||||
if (!githubResponse.ok) {
|
||||
throw new Error('获取信息失败');
|
||||
}
|
||||
|
||||
const Data = await githubResponse.json();
|
||||
|
||||
// 第二步:获取 Commit 数据
|
||||
const latestCommit = Data
|
||||
|
||||
const commitData = {
|
||||
hash: latestCommit.sha.slice(0, 7),
|
||||
fullHash: latestCommit.sha,
|
||||
message: latestCommit.commit.message.split('\n')[0],
|
||||
author: latestCommit.commit.author.name,
|
||||
date: latestCommit.commit.author.date,
|
||||
url: latestCommit.html_url
|
||||
};
|
||||
|
||||
|
||||
if (statsElement) {
|
||||
statsElement.textContent = `${Data.sha.slice(0,7)}`;
|
||||
}
|
||||
|
||||
if (hashElement) {
|
||||
hashElement.textContent = commitData.hash;
|
||||
}
|
||||
|
||||
if (fullHashElement) {
|
||||
fullHashElement.textContent = commitData.fullHash;
|
||||
}
|
||||
if (messageElement) {
|
||||
messageElement.textContent = commitData.message;
|
||||
}
|
||||
if (authorElement) {
|
||||
authorElement.textContent = commitData.author;
|
||||
}
|
||||
if (authorElementUrl) {
|
||||
authorElementUrl.href = "https://github.com/"+commitData.author;
|
||||
authorElementUrl.title = "查看提交者 "+commitData.author;
|
||||
}
|
||||
if (dateElement) {
|
||||
dateElement.textContent = commitData.date;
|
||||
}
|
||||
if (urlElement) {
|
||||
urlElement.textContent = commitData.url;
|
||||
}
|
||||
|
||||
if (fullElement) {
|
||||
fullElement.textContent = JSON.stringify(Data, null, 2);
|
||||
}
|
||||
|
||||
if (link){
|
||||
const gurl = "https://github.com/Ad-closeNN/blog-fuwari/commit/"+Data.sha;
|
||||
link.href = gurl;
|
||||
link.title = "("+Data.commit.committer.date + ")" + " " + Data.commit.message;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取 Commit 信息失败:', error);
|
||||
const statsElement = document.getElementById('github-commit2');
|
||||
if (statsElement) {
|
||||
statsElement.textContent = '提交信息不可用';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 页面加载完成后获取 Commit 数据
|
||||
addEventListener('DOMContentLoaded', loadCommitStats2);
|
||||
// 页面加载完成后获取 Commit 数据
|
||||
function initCommitStats() {
|
||||
// 检查是否在 info 页面
|
||||
if (window.location.pathname === '/info/') {
|
||||
loadCommitStats2();
|
||||
}
|
||||
}
|
||||
|
||||
// 初始加载
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', initCommitStats);
|
||||
} else {
|
||||
initCommitStats();
|
||||
}
|
||||
|
||||
// Swup 页面跳转后重新执行
|
||||
if (window.swup) {
|
||||
window.swup.hooks.on('page:view', initCommitStats);
|
||||
} else {
|
||||
document.addEventListener('swup:enable', () => {
|
||||
window.swup.hooks.on('page:view', initCommitStats);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</MainGridLayout>
|
||||
@@ -14,7 +14,7 @@ if (!aboutPost) {
|
||||
|
||||
const { Content } = await render(aboutPost);
|
||||
---
|
||||
<MainGridLayout title={i18n(I18nKey.about)} description={i18n(I18nKey.about)}>
|
||||
<MainGridLayout title={i18n(I18nKey.about)} description="关于">
|
||||
<div class="flex w-full rounded-[var(--radius-large)] overflow-hidden relative min-h-32">
|
||||
<div class="card-base z-10 px-9 py-6 relative w-full ">
|
||||
<Markdown class="mt-2">
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
---
|
||||
|
||||
import { getEntry, render } from "astro:content";
|
||||
import Markdown from "@components/misc/Markdown.astro";
|
||||
import I18nKey from "../i18n/i18nKey";
|
||||
import { i18n } from "../i18n/translation";
|
||||
import MainGridLayout from "../layouts/MainGridLayout.astro";
|
||||
import { addIssueToContext } from "astro:schema";
|
||||
const aboutPost = await getEntry("spec", "info");
|
||||
|
||||
if (!aboutPost) {
|
||||
throw new Error("About page content not found");
|
||||
}
|
||||
|
||||
const { Content } = await render(aboutPost);
|
||||
---
|
||||
|
||||
<MainGridLayout title="信息" description="信息">
|
||||
<div class="flex w-full rounded-[var(--radius-large)] overflow-hidden relative min-h-32">
|
||||
<div class="card-base z-10 px-9 py-6 relative w-full ">
|
||||
<Markdown class="mt-2">
|
||||
<Content />
|
||||
</Markdown>
|
||||
</div>
|
||||
</div>
|
||||
</MainGridLayout>
|
||||
@@ -14,7 +14,7 @@ if (!aboutPost) {
|
||||
|
||||
const { Content } = await render(aboutPost);
|
||||
---
|
||||
<MainGridLayout title="关于/MiSans" description={i18n(I18nKey.about)}>
|
||||
<MainGridLayout title="关于/MiSans" description="关于/MiSans">
|
||||
<div class="flex w-full rounded-[var(--radius-large)] overflow-hidden relative min-h-32">
|
||||
<div class="card-base z-10 px-9 py-6 relative w-full ">
|
||||
<Markdown class="mt-2">
|
||||
|
||||
@@ -143,6 +143,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
code, pre {
|
||||
font-family: 'JetBrainsMono-VF', 'Fira Code', 'Consolas', 'Monaco', 'Courier New', monospace;
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
@theme {
|
||||
--font-sans: 'Inter', 'sans-serif';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user