From a5e1e93c0d41d69638afe3d5e321bb1fcc0238bd Mon Sep 17 00:00:00 2001 From: KazooTTT Date: Fri, 11 Oct 2024 21:16:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E5=AE=BD=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- astro.config.mjs | 63 ++++++++++++++++++++---------------- src/layouts/BaseLayout.astro | 2 +- src/layouts/BlogPost.astro | 14 +++++++- 3 files changed, 49 insertions(+), 30 deletions(-) diff --git a/astro.config.mjs b/astro.config.mjs index fd086b4..1e49aaa 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -11,34 +11,41 @@ import icon from 'astro-icon' import vercel from '@astrojs/vercel/serverless' -import react from '@astrojs/react'; +import react from '@astrojs/react' // https://astro.build/config export default defineConfig({ - site: 'https://example.me', - integrations: [expressiveCode(expressiveCodeOptions), tailwind({ - applyBaseStyles: false - }), sitemap(), mdx(), icon(), react()], - markdown: { - remarkPlugins: [remarkUnwrapImages, remarkReadingTime], - rehypePlugins: [ - [ - rehypeExternalLinks, - { - target: '_blank', - rel: ['nofollow, noopener, noreferrer'] - } - ] - ], - remarkRehype: { - footnoteLabelProperties: { - className: [''] - } - } - }, - prefetch: true, - output: 'server', - adapter: vercel({ - webAnalytics: { enabled: true } - }) -}) \ No newline at end of file + site: 'https://blog.kazoottt.top', + integrations: [ + expressiveCode(expressiveCodeOptions), + tailwind({ + applyBaseStyles: false + }), + sitemap(), + mdx(), + icon(), + react() + ], + markdown: { + remarkPlugins: [remarkUnwrapImages, remarkReadingTime], + rehypePlugins: [ + [ + rehypeExternalLinks, + { + target: '_blank', + rel: ['nofollow, noopener, noreferrer'] + } + ] + ], + remarkRehype: { + footnoteLabelProperties: { + className: [''] + } + } + }, + prefetch: true, + output: 'server', + adapter: vercel({ + webAnalytics: { enabled: true } + }) +}) diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro index 608b15a..7bb0c54 100644 --- a/src/layouts/BaseLayout.astro +++ b/src/layouts/BaseLayout.astro @@ -25,7 +25,7 @@ const {
diff --git a/src/layouts/BlogPost.astro b/src/layouts/BlogPost.astro index 7281254..2a98ed9 100644 --- a/src/layouts/BlogPost.astro +++ b/src/layouts/BlogPost.astro @@ -4,7 +4,6 @@ import type { CollectionEntry } from 'astro:content' import BlogHero from '@/components/blog/Hero.astro' import TOC from '@/components/blog/TOC.astro' import Button from '@/components/Button.astro' - import PageLayout from './BaseLayout.astro' interface Props { @@ -44,7 +43,9 @@ const { headings } = await post.render()
@@ -88,4 +89,15 @@ const { headings } = await post.render() const observer = new IntersectionObserver(callback) observer.observe(targetHeader) + + import PhotoSwipeLightbox from 'photoswipe/lightbox' + import 'photoswipe/style.css' + + const lightbox = new PhotoSwipeLightbox({ + gallery: '#blog-gallery', + children: 'a', + pswpModule: () => import('photoswipe') + }) + + lightbox.init()