From 92b728f6d04c7376e327cf546cdbb7e85631a3a3 Mon Sep 17 00:00:00 2001 From: lyq <1661898579@qq.com> Date: Thu, 16 May 2024 23:19:25 +0800 Subject: [PATCH] fix archive page --- astro.config.mjs | 185 +++++++++--------- pnpm-lock.yaml | 25 ++- src/layouts/MarkdownPost.astro | 73 ++++--- src/layouts/MoreTile.astro | 19 +- src/pages/archive.astro | 32 ++- src/pages/index.astro | 2 +- .../20200103123203.jpg | Bin 18993 -> 0 bytes .../Apifox-860x320.ic7tz1417sw.png | Bin 269510 -> 0 bytes src/pages/posts/blogs/关于/关于.md | 35 ---- .../blogs/技术/C语言/从汇编角度看C语言-1.md | 3 +- .../blogs/技术/C语言/写C语言的种种工具.md | 3 +- .../posts/blogs/技术/GO语言/Go语言极限入门.md | 3 +- .../posts/blogs/技术/Linux/Linux笔记-信号.md | 3 +- .../blogs/技术/Linux/Linux笔记-文件I-O.md | 3 +- .../posts/blogs/技术/Linux/Linux笔记-进程.md | 3 +- .../Python爬虫实战-爬取TIOBE-TOP20语言排行榜.md | 3 +- .../Python爬虫实战-获取王者荣耀英雄大全.md | 3 +- .../blogs/更多/{ => 友情链接}/99.友情链接.md | 4 +- .../posts/blogs/更多/学习/vscode操作指北.md | 2 +- .../posts/blogs/更多/学习/寝室软路由记录.md | 2 +- .../posts/blogs/更多/学习/逆向工程小实战.md | 2 +- src/pages/posts/blogs/目录页/技术.md | 18 -- src/pages/posts/blogs/目录页/更多.md | 18 -- 23 files changed, 217 insertions(+), 224 deletions(-) delete mode 100644 src/pages/posts/blogs/关于/assets/c64060e53bc042129a4782947549ce1d/20200103123203.jpg delete mode 100644 src/pages/posts/blogs/关于/assets/c64060e53bc042129a4782947549ce1d/Apifox-860x320.ic7tz1417sw.png delete mode 100644 src/pages/posts/blogs/关于/关于.md rename src/pages/posts/blogs/更多/{ => 友情链接}/99.友情链接.md (96%) delete mode 100644 src/pages/posts/blogs/目录页/技术.md delete mode 100644 src/pages/posts/blogs/目录页/更多.md diff --git a/astro.config.mjs b/astro.config.mjs index 56fa0ab..a15f3bb 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -5,100 +5,101 @@ import { SITE_URL } from "./src/consts" import vue from "@astrojs/vue" import tailwind from "@astrojs/tailwind" import react from "@astrojs/react" + function pipeline() { return [ - () => (tree) => { - visit(tree, "element", (node, index) => { - if (node.tagName === "p" && node.children[0].tagName === "img") { - node.tagName = "figure" - let img = node.children[0] - let sign = md5(img.properties.src) - let data = img.properties.alt.split("|") - let alt = data[0] - let size = "big" - if (data.length > 1) { - size = data[1] - } - let classes = [ - "image component image-fullbleed body-copy-wide nr-scroll-animation nr-scroll-animation--on", - ] - classes.push(`image-${size}`) - node.properties.className = classes - node.children = [ - { - type: "element", - tagName: "div", - properties: { - className: ["component-content"], - }, - children: [ - { - type: "element", - tagName: "div", - properties: { - className: ["image-sharesheet"], - }, - children: [ - { - type: "element", - tagName: "div", - properties: { - className: [ - `image image-load image-asset image-${sign}`, - ], - id: `lht${sign}`, - }, - children: [ - { - type: "element", - tagName: "picture", - properties: { - className: ["picture"], - }, - children: [ - { - type: "element", - tagName: "img", - properties: { - "data-src": img.properties.src, - alt: alt, - className: ["picture-image"], - }, - }, - ], - }, - ], - }, - ], - }, - { - type: "element", - tagName: "div", - properties: { - className: ["image-description"], - }, - children: [ - { - type: "element", - tagName: "div", - properties: { - className: ["image-caption"], - }, - children: [ - { - type: "text", - value: alt, - }, - ], - }, - ], - }, - ], - }, - ] - } - }) - }, + // () => (tree) => { + // visit(tree, "element", (node, index) => { + // if (node.tagName === "p" && node.children[0].tagName === "img") { + // node.tagName = "figure" + // let img = node.children[0] + // let sign = md5(img.properties.src) + // let data = img.properties.alt.split("|") + // let alt = data[0] + // let size = "big" + // if (data.length > 1) { + // size = data[1] + // } + // let classes = [ + // "image component image-fullbleed body-copy-wide nr-scroll-animation nr-scroll-animation--on", + // ] + // classes.push(`image-${size}`) + // node.properties.className = classes + // node.children = [ + // { + // type: "element", + // tagName: "div", + // properties: { + // className: ["component-content"], + // }, + // children: [ + // { + // type: "element", + // tagName: "div", + // properties: { + // className: ["image-sharesheet"], + // }, + // children: [ + // { + // type: "element", + // tagName: "div", + // properties: { + // className: [ + // `image image-load image-asset image-${sign}`, + // ], + // id: `lht${sign}`, + // }, + // children: [ + // { + // type: "element", + // tagName: "picture", + // properties: { + // className: ["picture"], + // }, + // children: [ + // { + // type: "element", + // tagName: "img", + // properties: { + // "data-src": img.properties.src, + // alt: alt, + // className: ["picture-image"], + // }, + // }, + // ], + // }, + // ], + // }, + // ], + // }, + // { + // type: "element", + // tagName: "div", + // properties: { + // className: ["image-description"], + // }, + // children: [ + // { + // type: "element", + // tagName: "div", + // properties: { + // className: ["image-caption"], + // }, + // children: [ + // { + // type: "text", + // value: alt, + // }, + // ], + // }, + // ], + // }, + // ], + // }, + // ] + // } + // }) + // }, () => (tree) => { tree.children.forEach((node) => { if (node.type === "raw") { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 44010ca..1a6cdc6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1837,14 +1837,13 @@ packages: dev: false optional: true - /bare-fs@2.2.2: - resolution: {integrity: sha512-X9IqgvyB0/VA5OZJyb5ZstoN62AzD7YxVGog13kkfYWYqJYcK0kcqLZ6TrmH5qr4/8//ejVcX4x/a0UvaogXmA==} + /bare-fs@2.3.0: + resolution: {integrity: sha512-TNFqa1B4N99pds2a5NYHR15o0ZpdNKbAeKTE/+G6ED/UeOavv8RY3dr/Fu99HW3zU3pXpo2kDNO8Sjsm2esfOw==} requiresBuild: true dependencies: bare-events: 2.2.2 - bare-os: 2.2.1 - bare-path: 2.1.0 - streamx: 2.16.1 + bare-path: 2.1.2 + bare-stream: 1.0.0 dev: false optional: true @@ -1854,14 +1853,22 @@ packages: dev: false optional: true - /bare-path@2.1.0: - resolution: {integrity: sha512-DIIg7ts8bdRKwJRJrUMy/PICEaQZaPGZ26lsSx9MJSwIhSrcdHn7/C8W+XmnG/rKi6BaRcz+JO00CjZteybDtw==} + /bare-path@2.1.2: + resolution: {integrity: sha512-o7KSt4prEphWUHa3QUwCxUI00R86VdjiuxmJK0iNVDHYPGo+HsDaVCnqCmPbf/MiW1ok8F4p3m8RTHlWk8K2ig==} requiresBuild: true dependencies: bare-os: 2.2.1 dev: false optional: true + /bare-stream@1.0.0: + resolution: {integrity: sha512-KhNUoDL40iP4gFaLSsoGE479t0jHijfYdIcxRn/XtezA2BaUD0NRf/JGRpsMq6dMNM+SrCrB0YSSo/5wBY4rOQ==} + requiresBuild: true + dependencies: + streamx: 2.16.1 + dev: false + optional: true + /base-64@1.0.0: resolution: {integrity: sha512-kwDPIFCGx0NZHog36dj+tHiwP4QMzsZ3AgMViUBKI0+V5n4U0ufTCUMhnQ04diaRI8EX/QcPfql7zlhZ7j4zgg==} dev: false @@ -4364,8 +4371,8 @@ packages: pump: 3.0.0 tar-stream: 3.1.7 optionalDependencies: - bare-fs: 2.2.2 - bare-path: 2.1.0 + bare-fs: 2.3.0 + bare-path: 2.1.2 dev: false optional: true diff --git a/src/layouts/MarkdownPost.astro b/src/layouts/MarkdownPost.astro index 532532e..a47e241 100644 --- a/src/layouts/MarkdownPost.astro +++ b/src/layouts/MarkdownPost.astro @@ -1,30 +1,49 @@ --- -import BaseHead from "../components/BaseHead.astro"; -import Header from "../components/Header.astro"; -import Footer from "../components/Footer.astro"; +import BaseHead from "../components/BaseHead.astro" +import Header from "../components/Header.astro" +import Footer from "../components/Footer.astro" -import { formatDate } from "../utils"; -import { SITE_TITLE } from "../consts"; -const { frontmatter } = Astro.props; -const type = frontmatter.tags[0]; -const { pubDate, title, description, featured } = frontmatter; -const dateFormated = formatDate(pubDate); +import { formatDate } from "../utils" +import { SITE_TITLE } from "../consts" +const { frontmatter } = Astro.props +const type = frontmatter.tags?.[0] ?? "默认" +const { pubDate, title, description, featured } = frontmatter +const dateFormated = formatDate(pubDate) --- - + - + - +
-
+
- {type} + {type} {dateFormated}
@@ -34,19 +53,24 @@ const dateFormated = formatDate(pubDate);

{title}

-
+
{description}
{ - frontmatter.tags.map((tag) => { + frontmatter.tags?.map((tag) => { return ( {tag} - ); + ) }) }
@@ -56,10 +80,15 @@ const dateFormated = formatDate(pubDate);
- 版权声明:自由转载-非商用-非衍生-保持署名(创意共享3.0许可证) -

作者: {frontmatter.author} 发表日期:{dateFormated}

+

+ 作者: {frontmatter.author} 发表日期:{dateFormated} +

@@ -68,9 +97,9 @@ const dateFormated = formatDate(pubDate);