diff --git a/astro.config.mjs b/astro.config.mjs index 7924a21..bdc3539 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -1,5 +1,7 @@ import { defineConfig } from 'astro/config'; import sitemap from '@astrojs/sitemap'; +import { unified } from '@astrojs/markdown-remark'; +import remarkHexoLinkCards from './src/lib/remarkHexoLinkCards.mjs'; export default defineConfig({ site: 'https://blog.biss.click', @@ -8,6 +10,9 @@ export default defineConfig({ publicDir: './static', integrations: [sitemap()], markdown: { + processor: unified({ + remarkPlugins: [remarkHexoLinkCards], + }), shikiConfig: { theme: 'github-dark', wrap: true, diff --git a/src/components/Pagination.astro b/src/components/Pagination.astro new file mode 100644 index 0000000..f95e24b --- /dev/null +++ b/src/components/Pagination.astro @@ -0,0 +1,53 @@ +--- +type Props = { + currentPage: number; + totalPages: number; + basePath?: string; +}; + +const { currentPage, totalPages, basePath = '/' } = Astro.props; + +const normalizedBasePath = basePath.endsWith('/') ? basePath : `${basePath}/`; +const getPageHref = (page: number) => (page <= 1 ? normalizedBasePath : `${normalizedBasePath}page/${page}/`); +const pages = Array.from({ length: totalPages }, (_, index) => index + 1); +--- + +{ + totalPages > 1 && ( + + ) +} diff --git a/src/components/PostCopyrightCard.astro b/src/components/PostCopyrightCard.astro new file mode 100644 index 0000000..04b8600 --- /dev/null +++ b/src/components/PostCopyrightCard.astro @@ -0,0 +1,118 @@ +--- +import type { BlogPost } from '@/lib/posts'; + +interface Props { + post: BlogPost; +} + +const { post } = Astro.props; +const author = 'biss'; +const licenseName = 'CC BY-NC-SA 4.0'; +const licenseHref = 'https://creativecommons.org/licenses/by-nc-sa/4.0/'; +const postUrl = new URL(post.href, Astro.site ?? Astro.url.origin).toString(); +const displayPath = post.href; +const tags = post.tags; +--- + +
+ + +
+

{post.title}

+ {displayPath} + +
+
+
作者
+
{author}
+
+
+
发布于
+
+
+
+
许可协议
+
{licenseName}
+
+
+
+ +
+ {tags.length > 0 && ( +
+ {tags.map((tag) => {tag})} +
+ )} + +
+ + + + 订阅 + + + + 打赏 + + + + + + + +
+
+
+ + diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro index 00b9a9f..24d7e96 100644 --- a/src/layouts/BaseLayout.astro +++ b/src/layouts/BaseLayout.astro @@ -9,6 +9,7 @@ interface Props { const siteTitle = "Bi's Blog"; const { title = siteTitle, description = 'Personal blog by biss.' } = Astro.props; const pageTitle = title === siteTitle ? siteTitle : `${title} | ${siteTitle}`; +const currentYear = new Date().getFullYear(); --- @@ -36,9 +37,81 @@ const pageTitle = title === siteTitle ? siteTitle : `${title} | ${siteTitle}`;
-