From ad9fabe937760434e98a6263a85863a3bacd5d10 Mon Sep 17 00:00:00 2001 From: radishzzz Date: Fri, 21 Feb 2025 01:25:38 +0000 Subject: [PATCH] feat: enhance image handling and analytics configuration - Add @unpic/astro for improved image optimization - Configure image service with blurhash placeholder - Update analytics script to support custom JavaScript URLs - Modify preload configuration for more flexible analytics integration - Remove deprecated rehype image transformation plugin --- .vscode/settings.json | 2 + astro.config.ts | 11 +- package.json | 5 +- pnpm-lock.yaml | 236 ++++++++++++++++-------- src/config.ts | 8 +- src/content/posts/{故乡.md => 故乡.mdx} | 11 +- src/layouts/Head.astro | 88 ++++----- src/types/index.d.ts | 3 +- 8 files changed, 218 insertions(+), 146 deletions(-) rename src/content/posts/{故乡.md => 故乡.mdx} (95%) diff --git a/.vscode/settings.json b/.vscode/settings.json index 58263bd..c273f6a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -62,6 +62,7 @@ "antfu", "astrojs", "attributify", + "blurhash", "bmoji", "Frontmatter", "gtag", @@ -86,6 +87,7 @@ "titlebar", "Umami", "unocss", + "unpic", "vite", "waline", "weibo" diff --git a/astro.config.ts b/astro.config.ts index 5465769..91eee30 100644 --- a/astro.config.ts +++ b/astro.config.ts @@ -2,6 +2,7 @@ import mdx from '@astrojs/mdx' import partytown from '@astrojs/partytown' import sitemap from '@astrojs/sitemap' import { transformerCopyButton } from '@rehype-pretty/transformers' +import { imageService } from '@unpic/astro/service' import compress from 'astro-compress' import robotsTxt from 'astro-robots-txt' import { defineConfig } from 'astro/config' @@ -22,7 +23,6 @@ import { themeConfig } from './src/config.js' // Local plugins import { AdmonitionComponent } from './src/plugins/rehype-component-admonition.js' import { GithubCardComponent } from './src/plugins/rehype-component-github-card.js' -import { rehypeImgToFigure } from './src/plugins/rehype-img-to-figure.js' import { parseDirectiveNode } from './src/plugins/remark-directive-rehype.js' import { remarkExcerpt } from './src/plugins/remark-excerpt.js' import { remarkReadingTime } from './src/plugins/remark-reading-time.js' @@ -31,6 +31,7 @@ import { langMap } from './src/utils/ui' const { url } = themeConfig.site const { light, dark } = themeConfig.color const { locale } = themeConfig.global +const imageDomain = new URL(themeConfig.preload.imageHostURL as string).hostname export default defineConfig({ site: url, @@ -39,6 +40,13 @@ export default defineConfig({ prefetchAll: true, defaultStrategy: 'viewport', }, + image: { + domains: [imageDomain], + remotePatterns: [{ protocol: 'https' }], + service: imageService({ + placeholder: 'blurhash', + }), + }, i18n: { locales: Object.entries(langMap).map(([path, codes]) => ({ path, @@ -83,7 +91,6 @@ export default defineConfig({ rehypePlugins: [ rehypeSlug, rehypeKatex, - rehypeImgToFigure, [ rehypePrettyCode, { diff --git a/package.json b/package.json index 1cc2c37..a619b62 100644 --- a/package.json +++ b/package.json @@ -20,10 +20,11 @@ "@astrojs/rss": "^4.0.11", "@astrojs/sitemap": "^3.2.1", "@rehype-pretty/transformers": "^0.13.2", + "@unpic/astro": "^1.0.0", "astro": "^5.3.0", "astro-compress": "^2.3.6", "astro-robots-txt": "^1.0.0", - "hastscript": "^9.0.0", + "hastscript": "^9.0.1", "markdown-it": "^14.1.0", "overlayscrollbars": "^2.11.0", "photoswipe": "^5.4.4", @@ -41,7 +42,7 @@ "sharp": "^0.33.5", "typescript": "~5.7.3", "unist-util-visit": "^5.0.0", - "vite": "^6.1.0" + "vite": "^6.1.1" }, "devDependencies": { "@antfu/eslint-config": "^4.3.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6e4737a..2aee930 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -26,6 +26,9 @@ importers: '@rehype-pretty/transformers': specifier: ^0.13.2 version: 0.13.2 + '@unpic/astro': + specifier: ^1.0.0 + version: 1.0.0(astro@5.3.0(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(rollup@4.34.8)(terser@5.37.0)(typescript@5.7.3)(yaml@2.7.0)) astro: specifier: ^5.3.0 version: 5.3.0(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(rollup@4.34.8)(terser@5.37.0)(typescript@5.7.3)(yaml@2.7.0) @@ -36,8 +39,8 @@ importers: specifier: ^1.0.0 version: 1.0.0 hastscript: - specifier: ^9.0.0 - version: 9.0.0 + specifier: ^9.0.1 + version: 9.0.1 markdown-it: specifier: ^14.1.0 version: 14.1.0 @@ -90,8 +93,8 @@ importers: specifier: ^5.0.0 version: 5.0.0 vite: - specifier: ^6.1.0 - version: 6.1.0(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0) + specifier: ^6.1.1 + version: 6.1.1(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0) devDependencies: '@antfu/eslint-config': specifier: ^4.3.0 @@ -137,7 +140,7 @@ importers: version: 1.5.0 unocss: specifier: ^66.0.0 - version: 66.0.0(postcss@8.5.2)(vite@6.1.0(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0))(vue@3.5.13(typescript@5.7.3)) + version: 66.0.0(postcss@8.5.3)(vite@6.1.1(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0))(vue@3.5.13(typescript@5.7.3)) unocss-preset-theme: specifier: ^0.14.1 version: 0.14.1(@unocss/core@66.0.0) @@ -535,8 +538,8 @@ packages: resolution: {integrity: sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==} engines: {node: '>=18.18'} - '@humanwhocodes/retry@0.4.1': - resolution: {integrity: sha512-c7hNEllBlenFTHBky65mhq8WD2kbN9Q6gk0bTk8lSBvc554jpXSkST1iePudpt7+A/AQvuHs9EMqjHDXMY1lrA==} + '@humanwhocodes/retry@0.4.2': + resolution: {integrity: sha512-xeO57FpIu4p1Ri3Jq/EXq4ClRm86dVF2z/+kvFnyqVYRavTZmaFaUBbWCOuuTh0o/g7DSsk6kc2vrS4Vl5oPOQ==} engines: {node: '>=18.18'} '@iconify/types@2.0.0': @@ -833,8 +836,8 @@ packages: '@shikijs/vscode-textmate@10.0.2': resolution: {integrity: sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg==} - '@stylistic/eslint-plugin@4.0.0': - resolution: {integrity: sha512-3US6mWvUrb7xrKs5TR6Ak3Mw8ghSu8gx/lOOkqxUWm1Bw89A9N6PsOUFd4N7aVmlr4VugOqgOdHfBKyt3BsEig==} + '@stylistic/eslint-plugin@4.0.1': + resolution: {integrity: sha512-RwKkRKiDrF4ptiur54ckDhOByQYKYZ1dEmI5K8BJCmuGpauFJXzVL1UQYTA2zq702CqMFdYiJcVFJWfokIgFxw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: '>=9.0.0' @@ -915,6 +918,9 @@ packages: '@types/normalize-package-data@2.4.4': resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==} + '@types/pngjs@6.0.5': + resolution: {integrity: sha512-0k5eKfrA83JOZPppLtS2C7OUtyNAl2wKNxfyYl9Q5g9lPkgBl/9hNyAu6HuEH2J4XmIv2znEpkDd0SaZVxW6iQ==} + '@types/sanitize-html@2.13.0': resolution: {integrity: sha512-X31WxbvW9TjIhZZNyNBZ/p5ax4ti7qsNDBDEnH4zAgmEh35YnFD1UiS6z9Cd34kKm0LslFW0KPmTQzu/oGtsqQ==} @@ -1071,6 +1077,20 @@ packages: peerDependencies: vite: ^2.9.0 || ^3.0.0-0 || ^4.0.0 || ^5.0.0-0 || ^6.0.0-0 + '@unpic/astro@1.0.0': + resolution: {integrity: sha512-LC7PriiuAZ5EuD2u2Dgne5UzG+FvuyZNV0zc1ajkJXX4sUMOvj0FWjZc0pEYEgzTnlOGkN91x2nI9gEtDSOIyA==} + peerDependencies: + astro: ^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0-beta + + '@unpic/core@1.0.1': + resolution: {integrity: sha512-e0cwxOhtWPd4J32rV1V6jFmDGAi1r4p/f+lDqlnx+fhgFwMTyQQKw5lL7VEthUPBHFNaNBsXNbNKwnaIs2V71Q==} + + '@unpic/pixels@1.3.0': + resolution: {integrity: sha512-Xe3J4KU9m2NWCDZ9iwIIRYFe7VwkWEqGCy4yoKMEkjoxpcQ7TPxD+QmdTphv3yiTmrDMMIWYEEH+j4mT6dILTA==} + + '@unpic/placeholder@0.1.2': + resolution: {integrity: sha512-O++tS97biojo5sqn5TeTt+jUjl5gWOdIQuOXe8YluTJWq4L0GM6VuTkaspNpsmxHfioJw/6YBirzOpG4t87l8Q==} + '@vitest/eslint-plugin@1.1.31': resolution: {integrity: sha512-xlsLr+e+AXZ/00eVZCtNmMeCJoJaRCoLDiAgLcxgQjSS1EertieB2MUHf8xIqPKs9lECc/UpL+y1xDcpvi02hw==} peerDependencies: @@ -1248,6 +1268,9 @@ packages: resolution: {integrity: sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==} engines: {node: '>=8'} + blurhash@2.0.5: + resolution: {integrity: sha512-cRygWd7kGBQO3VEhPiTgq4Wc43ctsM+o46urrmPOiuAe+07fzlSB9OJVdpgDL0jPqXUVQ9ht7aq7kxOeJHRK+w==} + boolbase@1.0.0: resolution: {integrity: sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==} @@ -2002,8 +2025,8 @@ packages: hast-util-from-html@2.0.3: resolution: {integrity: sha512-CUSRHXyKjzHov8yKsQjGOElXy/3EKpyX56ELnkHH34vDVw1N1XSQ1ZcAvTyAPtGqLTuKP/uxM+aLkSPqF/EtMw==} - hast-util-from-parse5@8.0.2: - resolution: {integrity: sha512-SfMzfdAi/zAoZ1KkFEyyeXBn7u/ShQrfd675ZEE9M3qj+PMFX05xubzRyF76CCSJu8au9jgVxDV1+okFvgZU4A==} + hast-util-from-parse5@8.0.3: + resolution: {integrity: sha512-3kxEVkEKt0zvcZ3hCRYI8rqrgwtlIOFMWkbclACvjlDw8Li9S2hk/d51OI0nr/gIpdMHNepwgOKqZ/sy0Clpyg==} hast-util-heading-rank@3.0.0: resolution: {integrity: sha512-EJKb8oMUXVHcWZTDepnr+WNbfnXKFNf9duMesmr4S8SXTJBJ9M4Yok08pu9vxdJwdlGRhVumk9mEhkEvKGifwA==} @@ -2017,14 +2040,14 @@ packages: hast-util-raw@9.1.0: resolution: {integrity: sha512-Y8/SBAHkZGoNkpzqqfCldijcuUKh7/su31kEBp67cFY09Wy0mTRgtsLYsiIxMJxlu0f6AA5SUTbDR8K0rxnbUw==} - hast-util-to-estree@3.1.1: - resolution: {integrity: sha512-IWtwwmPskfSmma9RpzCappDUitC8t5jhAynHhc1m2+5trOgsrp7txscUSavc5Ic8PATyAjfrCK1wgtxh2cICVQ==} + hast-util-to-estree@3.1.2: + resolution: {integrity: sha512-94SDoKOfop5gP8RHyw4vV1aj+oChuD42g08BONGAaWFbbO6iaWUqxk7SWfGybgcVzhK16KifZr3zD2dqQgx3jQ==} - hast-util-to-html@9.0.4: - resolution: {integrity: sha512-wxQzXtdbhiwGAUKrnQJXlOPmHnEehzphwkK7aluUPQ+lEc1xefC8pblMgpp2w5ldBTEfveRIrADcrhGIWrlTDA==} + hast-util-to-html@9.0.5: + resolution: {integrity: sha512-OguPdidb+fbHQSU4Q4ZiLKnzWo8Wwsf5bZfbvu7//a9oTYoqD/fWpe96NuHkoS9h0ccGOTe0C4NGXdtS0iObOw==} - hast-util-to-jsx-runtime@2.3.2: - resolution: {integrity: sha512-1ngXYb+V9UT5h+PxNRa1O1FYguZK/XL+gkeqvp7EdHlB9oHUG0eYRo/vY5inBdcqo3RkPMC58/H94HvkbfGdyg==} + hast-util-to-jsx-runtime@2.3.3: + resolution: {integrity: sha512-pdpkP8YD4v+qMKn2lnKSiJvZvb3FunDmFYQvVOsoO08+eTNWdaWKPMrC5wwNICtU3dQWHhElj5Sf5jPEnv4qJg==} hast-util-to-parse5@8.0.0: resolution: {integrity: sha512-3KKrV5ZVI8if87DVSi1vDeByYrkGzg4mEfeu4alwgmmIeARiBLKCZS2uw5Gb6nU9x9Yufyj3iudm6i7nl52PFw==} @@ -2038,8 +2061,8 @@ packages: hast-util-whitespace@3.0.0: resolution: {integrity: sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==} - hastscript@9.0.0: - resolution: {integrity: sha512-jzaLBGavEDKHrc5EfFImKN7nZKKBdSLIdGvCwDZ9TfzbF2ffXiov8CKE445L2Z1Ek2t/m4SKQ2j6Ipv7NyUolw==} + hastscript@9.0.1: + resolution: {integrity: sha512-g7df9rMFX/SPi34tyGCyUBREQoKkapwdY/T04Qn9TDWfHhAYt4/I0gMVirzK5wEzeUqIjEB+LXC/ypb7Aqno5w==} hosted-git-info@7.0.2: resolution: {integrity: sha512-puUZAUKT5m8Zzvs72XWy3HtvVbTWljRE66cP60bxJzAqf2DgICo7lYTY2IHUmLnNpjYvw5bvmoHvPc0QO2a62w==} @@ -2183,6 +2206,9 @@ packages: resolution: {integrity: sha512-rg9zJN+G4n2nfJl5MW3BMygZX56zKPNVEYYqq7adpmMh4Jn2QNEwhvQlFy6jPVdcod7txZtKHWnyZiA3a0zP7A==} hasBin: true + jpeg-js@0.4.4: + resolution: {integrity: sha512-WZzeDOEtTOBK4Mdsar0IqEU5sMr3vSV2RqkAIzUEV2BHnUfKGyswWFPFwK5EeDo93K3FohSHbLAjj0s1Wzd+dg==} + js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} @@ -2808,6 +2834,10 @@ packages: resolution: {integrity: sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==} engines: {node: '>=4'} + pngjs@7.0.0: + resolution: {integrity: sha512-LKWqWJRhstyYo9pGvgor/ivk2w94eSjE3RGVuzLGlr3NmD8bf7RcYGze1mNdEHRP6TRP6rMuDHk5t44hnTRyow==} + engines: {node: '>=14.19.0'} + postcss-selector-parser@6.1.2: resolution: {integrity: sha512-Q8qQfPiZ+THO/3ZrOrO0cJJKfpYCagtMUkXbnEfmgUjwXg6z/WBeOyS9APBBPCTSiDV+s4SwQGu8yFsiMRIudg==} engines: {node: '>=4'} @@ -2816,8 +2846,8 @@ packages: resolution: {integrity: sha512-8sLjZwK0R+JlxlYcTuVnyT2v+htpdrjDOKuMcOVdYjt52Lh8hWRYpxBPoKx/Zg+bcjc3wx6fmQevMmUztS/ccA==} engines: {node: '>=4'} - postcss@8.5.2: - resolution: {integrity: sha512-MjOadfU3Ys9KYoX0AdkBlFEF1Vx37uCCeN4ZHnmwm9FfpbsGWMZeBLMmmpY+6Ocqod7mkdZ0DT31OlbsFrLlkA==} + postcss@8.5.3: + resolution: {integrity: sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A==} engines: {node: ^10 || ^12 || >=14} preferred-pm@4.1.1: @@ -2844,6 +2874,9 @@ packages: property-information@6.5.0: resolution: {integrity: sha512-PgTgs/BlvHxOu8QuEN7wi5A0OmXaBcHpmCSTehcs6Uuu9IkDIEo13Hy7n898RHfrQ49vKCoGeWZSaAK01nwVig==} + property-information@7.0.0: + resolution: {integrity: sha512-7D/qOz/+Y4X/rzSB6jKxKUsQnphO046ei8qxG59mtM3RG3DHgTK81HrxrmoDVINJb8NKT5ZsRbwHvQ6B68Iyhg==} + punycode.js@2.3.1: resolution: {integrity: sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==} engines: {node: '>=6'} @@ -3188,8 +3221,8 @@ packages: resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} engines: {node: '>=8'} - strnum@1.0.5: - resolution: {integrity: sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==} + strnum@1.1.0: + resolution: {integrity: sha512-a4NGarQIHRhvr+k8VXaHg6TMU6f3YEmi5CAb6RYgX2gwbGDBNMbr6coC6g0wmif5dLjHtmHUVD/qOxPq7D0tnQ==} style-to-object@1.0.8: resolution: {integrity: sha512-xT47I/Eo0rwJmaXC4oilDGDWLohVhR6o/xAQcPQN8q6QBuZVL8qMYL85kLmST5cPjAorwvqIA4qXTRQoYHaL6g==} @@ -3227,8 +3260,8 @@ packages: tinyexec@0.3.2: resolution: {integrity: sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==} - tinyglobby@0.2.11: - resolution: {integrity: sha512-32TmKeeKUahv0Go8WmQgiEp9Y21NuxjwjqiRC1nrUB51YacfSwuB44xgXD+HdIppmMRgjQNPdrHyA6vIybYZ+g==} + tinyglobby@0.2.12: + resolution: {integrity: sha512-qkf4trmKSIiMTs/E63cxH+ojC2unam7rJ0WrauAzpT3ECNTxGRMlaXxVbfxMUC/w0LaYk6jQ4y/nGR9uBO3tww==} engines: {node: '>=12.0.0'} to-regex-range@5.0.1: @@ -3375,6 +3408,9 @@ packages: vite: optional: true + unpic@4.1.2: + resolution: {integrity: sha512-sau6i25EUxumNIL7e0kDpPWkVw3yxghLYcEwxPvm08263UfABDxtUJPT3H55z7W15cVXJB/PEhw4z6Oc+idWCA==} + unplugin-utils@0.2.4: resolution: {integrity: sha512-8U/MtpkPkkk3Atewj1+RcKIjb5WBimZ/WSLhhR3w6SsIj8XJuKTacSP8g+2JhfSGw0Cb125Y+2zA/IzJZDVbhA==} engines: {node: '>=18.12.0'} @@ -3466,8 +3502,8 @@ packages: vfile@6.0.3: resolution: {integrity: sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==} - vite@6.1.0: - resolution: {integrity: sha512-RjjMipCKVoR4hVfPY6GQTgveinjNuyLw+qruksLDvA5ktI1150VmcMBKmQaEWJhg/j6Uaf6dNCNA0AfdzUb/hQ==} + vite@6.1.1: + resolution: {integrity: sha512-4GgM54XrwRfrOp297aIYspIti66k56v16ZnqHvrIM7mG+HjDlAwS7p+Srr7J6fGvEdOJ5JcQ/D9T7HhtdXDTzA==} engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} hasBin: true peerDependencies: @@ -3723,8 +3759,8 @@ packages: resolution: {integrity: sha512-GQHQqAopRhwU8Kt1DDM8NjibDXHC8eoh1erhGAJPEyveY9qqVeXvVikNKrDz69sHowPMorbPUrH/mx8c50eiBQ==} engines: {node: '>=18'} - zod-to-json-schema@3.24.1: - resolution: {integrity: sha512-3h08nf3Vw3Wl3PK+q3ow/lIil81IT2Oa7YpQyUUDsEWbXveMesdfK1xBd2RhCkynwZndAxixji/7SYJJowr62w==} + zod-to-json-schema@3.24.2: + resolution: {integrity: sha512-pNUqrcSxuuB3/+jBbU8qKUbTbDqYUaG1vf5cXFjbhGgoUuA1amO/y4Q8lzfOhHU8HNPK6VFJ18lBDKj3OHyDsg==} peerDependencies: zod: ^3.24.1 @@ -3753,7 +3789,7 @@ snapshots: '@clack/prompts': 0.10.0 '@eslint-community/eslint-plugin-eslint-comments': 4.4.1(eslint@9.20.1(jiti@2.4.2)) '@eslint/markdown': 6.2.2 - '@stylistic/eslint-plugin': 4.0.0(eslint@9.20.1(jiti@2.4.2))(typescript@5.7.3) + '@stylistic/eslint-plugin': 4.0.1(eslint@9.20.1(jiti@2.4.2))(typescript@5.7.3) '@typescript-eslint/eslint-plugin': 8.24.1(@typescript-eslint/parser@8.24.1(eslint@9.20.1(jiti@2.4.2))(typescript@5.7.3))(eslint@9.20.1(jiti@2.4.2))(typescript@5.7.3) '@typescript-eslint/parser': 8.24.1(eslint@9.20.1(jiti@2.4.2))(typescript@5.7.3) '@vitest/eslint-plugin': 1.1.31(@typescript-eslint/utils@8.24.1(eslint@9.20.1(jiti@2.4.2))(typescript@5.7.3))(eslint@9.20.1(jiti@2.4.2))(typescript@5.7.3) @@ -3875,7 +3911,7 @@ snapshots: astro: 5.3.0(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(rollup@4.34.8)(terser@5.37.0)(typescript@5.7.3)(yaml@2.7.0) es-module-lexer: 1.6.0 estree-util-visit: 2.0.0 - hast-util-to-html: 9.0.4 + hast-util-to-html: 9.0.5 kleur: 4.1.5 rehype-raw: 7.0.0 remark-gfm: 4.0.1 @@ -4147,7 +4183,7 @@ snapshots: '@humanwhocodes/retry@0.3.1': {} - '@humanwhocodes/retry@0.4.1': {} + '@humanwhocodes/retry@0.4.2': {} '@iconify/types@2.0.0': {} @@ -4272,7 +4308,7 @@ snapshots: estree-util-is-identifier-name: 3.0.0 estree-util-scope: 1.0.0 estree-walker: 3.0.3 - hast-util-to-jsx-runtime: 2.3.2 + hast-util-to-jsx-runtime: 2.3.3 markdown-extensions: 2.0.0 recma-build-jsx: 1.0.0 recma-jsx: 1.0.0(acorn@8.14.0) @@ -4393,7 +4429,7 @@ snapshots: '@shikijs/types': 1.29.2 '@shikijs/vscode-textmate': 10.0.2 '@types/hast': 3.0.4 - hast-util-to-html: 9.0.4 + hast-util-to-html: 9.0.5 '@shikijs/engine-javascript@1.29.2': dependencies: @@ -4421,7 +4457,7 @@ snapshots: '@shikijs/vscode-textmate@10.0.2': {} - '@stylistic/eslint-plugin@4.0.0(eslint@9.20.1(jiti@2.4.2))(typescript@5.7.3)': + '@stylistic/eslint-plugin@4.0.1(eslint@9.20.1(jiti@2.4.2))(typescript@5.7.3)': dependencies: '@typescript-eslint/utils': 8.24.1(eslint@9.20.1(jiti@2.4.2))(typescript@5.7.3) eslint: 9.20.1(jiti@2.4.2) @@ -4507,6 +4543,10 @@ snapshots: '@types/normalize-package-data@2.4.4': {} + '@types/pngjs@6.0.5': + dependencies: + '@types/node': 22.13.4 + '@types/sanitize-html@2.13.0': dependencies: htmlparser2: 8.0.2 @@ -4598,13 +4638,13 @@ snapshots: '@ungap/structured-clone@1.3.0': {} - '@unocss/astro@66.0.0(vite@6.1.0(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0))(vue@3.5.13(typescript@5.7.3))': + '@unocss/astro@66.0.0(vite@6.1.1(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0))(vue@3.5.13(typescript@5.7.3))': dependencies: '@unocss/core': 66.0.0 '@unocss/reset': 66.0.0 - '@unocss/vite': 66.0.0(vite@6.1.0(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0))(vue@3.5.13(typescript@5.7.3)) + '@unocss/vite': 66.0.0(vite@6.1.1(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0))(vue@3.5.13(typescript@5.7.3)) optionalDependencies: - vite: 6.1.0(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0) + vite: 6.1.1(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0) transitivePeerDependencies: - vue @@ -4621,7 +4661,7 @@ snapshots: magic-string: 0.30.17 pathe: 2.0.3 perfect-debounce: 1.0.0 - tinyglobby: 0.2.11 + tinyglobby: 0.2.12 unplugin-utils: 0.2.4 '@unocss/config@66.0.0': @@ -4661,14 +4701,14 @@ snapshots: transitivePeerDependencies: - vue - '@unocss/postcss@66.0.0(postcss@8.5.2)': + '@unocss/postcss@66.0.0(postcss@8.5.3)': dependencies: '@unocss/config': 66.0.0 '@unocss/core': 66.0.0 '@unocss/rule-utils': 66.0.0 css-tree: 3.1.0 - postcss: 8.5.2 - tinyglobby: 0.2.11 + postcss: 8.5.3 + tinyglobby: 0.2.12 '@unocss/preset-attributify@66.0.0': dependencies: @@ -4749,7 +4789,7 @@ snapshots: dependencies: '@unocss/core': 66.0.0 - '@unocss/vite@66.0.0(vite@6.1.0(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0))(vue@3.5.13(typescript@5.7.3))': + '@unocss/vite@66.0.0(vite@6.1.1(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0))(vue@3.5.13(typescript@5.7.3))': dependencies: '@ampproject/remapping': 2.3.0 '@unocss/config': 66.0.0 @@ -4757,12 +4797,34 @@ snapshots: '@unocss/inspector': 66.0.0(vue@3.5.13(typescript@5.7.3)) chokidar: 3.6.0 magic-string: 0.30.17 - tinyglobby: 0.2.11 + tinyglobby: 0.2.12 unplugin-utils: 0.2.4 - vite: 6.1.0(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0) + vite: 6.1.1(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0) transitivePeerDependencies: - vue + '@unpic/astro@1.0.0(astro@5.3.0(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(rollup@4.34.8)(terser@5.37.0)(typescript@5.7.3)(yaml@2.7.0))': + dependencies: + '@unpic/core': 1.0.1 + '@unpic/pixels': 1.3.0 + '@unpic/placeholder': 0.1.2 + astro: 5.3.0(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(rollup@4.34.8)(terser@5.37.0)(typescript@5.7.3)(yaml@2.7.0) + blurhash: 2.0.5 + + '@unpic/core@1.0.1': + dependencies: + unpic: 4.1.2 + + '@unpic/pixels@1.3.0': + dependencies: + '@types/pngjs': 6.0.5 + jpeg-js: 0.4.4 + pngjs: 7.0.0 + + '@unpic/placeholder@0.1.2': + dependencies: + blurhash: 2.0.5 + '@vitest/eslint-plugin@1.1.31(@typescript-eslint/utils@8.24.1(eslint@9.20.1(jiti@2.4.2))(typescript@5.7.3))(eslint@9.20.1(jiti@2.4.2))(typescript@5.7.3)': dependencies: '@typescript-eslint/utils': 8.24.1(eslint@9.20.1(jiti@2.4.2))(typescript@5.7.3) @@ -4842,7 +4904,7 @@ snapshots: '@vue/shared': 3.5.13 estree-walker: 2.0.2 magic-string: 0.30.17 - postcss: 8.5.2 + postcss: 8.5.3 source-map-js: 1.2.1 '@vue/compiler-ssr@3.5.13': @@ -5057,14 +5119,14 @@ snapshots: unist-util-visit: 5.0.0 unstorage: 1.14.4 vfile: 6.0.3 - vite: 6.1.0(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0) - vitefu: 1.0.5(vite@6.1.0(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0)) + vite: 6.1.1(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0) + vitefu: 1.0.5(vite@6.1.1(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0)) which-pm: 3.0.1 xxhash-wasm: 1.1.0 yargs-parser: 21.1.1 yocto-spinner: 0.2.0 zod: 3.24.2 - zod-to-json-schema: 3.24.1(zod@3.24.2) + zod-to-json-schema: 3.24.2(zod@3.24.2) zod-to-ts: 1.2.0(typescript@5.7.3)(zod@3.24.2) optionalDependencies: sharp: 0.33.5 @@ -5117,6 +5179,8 @@ snapshots: binary-extensions@2.3.0: {} + blurhash@2.0.5: {} + boolbase@1.0.0: {} boxen@8.0.1: @@ -5525,7 +5589,7 @@ snapshots: eslint: 9.20.1(jiti@2.4.2) eslint-compat-utils: 0.6.4(eslint@9.20.1(jiti@2.4.2)) globals: 15.15.0 - postcss: 8.5.2 + postcss: 8.5.3 postcss-selector-parser: 7.1.0 transitivePeerDependencies: - supports-color @@ -5719,7 +5783,7 @@ snapshots: '@eslint/plugin-kit': 0.2.6 '@humanfs/node': 0.16.6 '@humanwhocodes/module-importer': 1.0.1 - '@humanwhocodes/retry': 0.4.1 + '@humanwhocodes/retry': 0.4.2 '@types/estree': 1.0.6 '@types/json-schema': 7.0.15 ajv: 6.12.6 @@ -5844,7 +5908,7 @@ snapshots: fast-xml-parser@4.5.2: dependencies: - strnum: 1.0.5 + strnum: 1.1.0 fastq@1.19.0: dependencies: @@ -5953,7 +6017,7 @@ snapshots: hast-util-from-dom@5.0.1: dependencies: '@types/hast': 3.0.4 - hastscript: 9.0.0 + hastscript: 9.0.1 web-namespaces: 2.0.1 hast-util-from-html-isomorphic@2.0.0: @@ -5967,18 +6031,18 @@ snapshots: dependencies: '@types/hast': 3.0.4 devlop: 1.1.0 - hast-util-from-parse5: 8.0.2 + hast-util-from-parse5: 8.0.3 parse5: 7.2.1 vfile: 6.0.3 vfile-message: 4.0.2 - hast-util-from-parse5@8.0.2: + hast-util-from-parse5@8.0.3: dependencies: '@types/hast': 3.0.4 '@types/unist': 3.0.3 devlop: 1.1.0 - hastscript: 9.0.0 - property-information: 6.5.0 + hastscript: 9.0.1 + property-information: 7.0.0 vfile: 6.0.3 vfile-location: 5.0.3 web-namespaces: 2.0.1 @@ -6000,7 +6064,7 @@ snapshots: '@types/hast': 3.0.4 '@types/unist': 3.0.3 '@ungap/structured-clone': 1.3.0 - hast-util-from-parse5: 8.0.2 + hast-util-from-parse5: 8.0.3 hast-util-to-parse5: 8.0.0 html-void-elements: 3.0.0 mdast-util-to-hast: 13.2.0 @@ -6011,7 +6075,7 @@ snapshots: web-namespaces: 2.0.1 zwitch: 2.0.4 - hast-util-to-estree@3.1.1: + hast-util-to-estree@3.1.2: dependencies: '@types/estree': 1.0.6 '@types/estree-jsx': 1.0.5 @@ -6024,7 +6088,7 @@ snapshots: mdast-util-mdx-expression: 2.0.1 mdast-util-mdx-jsx: 3.2.0 mdast-util-mdxjs-esm: 2.0.1 - property-information: 6.5.0 + property-information: 7.0.0 space-separated-tokens: 2.0.2 style-to-object: 1.0.8 unist-util-position: 5.0.0 @@ -6032,7 +6096,7 @@ snapshots: transitivePeerDependencies: - supports-color - hast-util-to-html@9.0.4: + hast-util-to-html@9.0.5: dependencies: '@types/hast': 3.0.4 '@types/unist': 3.0.3 @@ -6041,12 +6105,12 @@ snapshots: hast-util-whitespace: 3.0.0 html-void-elements: 3.0.0 mdast-util-to-hast: 13.2.0 - property-information: 6.5.0 + property-information: 7.0.0 space-separated-tokens: 2.0.2 stringify-entities: 4.0.4 zwitch: 2.0.4 - hast-util-to-jsx-runtime@2.3.2: + hast-util-to-jsx-runtime@2.3.3: dependencies: '@types/estree': 1.0.6 '@types/hast': 3.0.4 @@ -6058,7 +6122,7 @@ snapshots: mdast-util-mdx-expression: 2.0.1 mdast-util-mdx-jsx: 3.2.0 mdast-util-mdxjs-esm: 2.0.1 - property-information: 6.5.0 + property-information: 7.0.0 space-separated-tokens: 2.0.2 style-to-object: 1.0.8 unist-util-position: 5.0.0 @@ -6091,12 +6155,12 @@ snapshots: dependencies: '@types/hast': 3.0.4 - hastscript@9.0.0: + hastscript@9.0.1: dependencies: '@types/hast': 3.0.4 comma-separated-tokens: 2.0.3 hast-util-parse-selector: 4.0.0 - property-information: 6.5.0 + property-information: 7.0.0 space-separated-tokens: 2.0.2 hosted-git-info@7.0.2: @@ -6210,6 +6274,8 @@ snapshots: jiti@2.4.2: {} + jpeg-js@0.4.4: {} + js-tokens@4.0.0: {} js-yaml@3.14.1: @@ -7123,6 +7189,8 @@ snapshots: pluralize@8.0.0: {} + pngjs@7.0.0: {} + postcss-selector-parser@6.1.2: dependencies: cssesc: 3.0.0 @@ -7133,7 +7201,7 @@ snapshots: cssesc: 3.0.0 util-deprecate: 1.0.2 - postcss@8.5.2: + postcss@8.5.3: dependencies: nanoid: 3.3.8 picocolors: 1.1.1 @@ -7159,6 +7227,8 @@ snapshots: property-information@6.5.0: {} + property-information@7.0.0: {} + punycode.js@2.3.1: {} punycode@2.3.1: {} @@ -7304,7 +7374,7 @@ snapshots: dependencies: '@types/estree': 1.0.6 '@types/hast': 3.0.4 - hast-util-to-estree: 3.1.1 + hast-util-to-estree: 3.1.2 transitivePeerDependencies: - supports-color @@ -7319,7 +7389,7 @@ snapshots: rehype-stringify@10.0.1: dependencies: '@types/hast': 3.0.4 - hast-util-to-html: 9.0.4 + hast-util-to-html: 9.0.5 unified: 11.0.5 rehype@13.0.2: @@ -7499,7 +7569,7 @@ snapshots: htmlparser2: 8.0.2 is-plain-object: 5.0.0 parse-srcset: 1.0.2 - postcss: 8.5.2 + postcss: 8.5.3 sax@1.4.1: {} @@ -7664,7 +7734,7 @@ snapshots: strip-json-comments@3.1.1: {} - strnum@1.0.5: {} + strnum@1.1.0: {} style-to-object@1.0.8: dependencies: @@ -7706,7 +7776,7 @@ snapshots: tinyexec@0.3.2: {} - tinyglobby@0.2.11: + tinyglobby@0.2.12: dependencies: fdir: 6.4.3(picomatch@4.0.2) picomatch: 4.0.2 @@ -7850,12 +7920,12 @@ snapshots: '@unocss/core': 66.0.0 '@unocss/rule-utils': 0.63.6 - unocss@66.0.0(postcss@8.5.2)(vite@6.1.0(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0))(vue@3.5.13(typescript@5.7.3)): + unocss@66.0.0(postcss@8.5.3)(vite@6.1.1(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0))(vue@3.5.13(typescript@5.7.3)): dependencies: - '@unocss/astro': 66.0.0(vite@6.1.0(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0))(vue@3.5.13(typescript@5.7.3)) + '@unocss/astro': 66.0.0(vite@6.1.1(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0))(vue@3.5.13(typescript@5.7.3)) '@unocss/cli': 66.0.0 '@unocss/core': 66.0.0 - '@unocss/postcss': 66.0.0(postcss@8.5.2) + '@unocss/postcss': 66.0.0(postcss@8.5.3) '@unocss/preset-attributify': 66.0.0 '@unocss/preset-icons': 66.0.0 '@unocss/preset-mini': 66.0.0 @@ -7869,14 +7939,16 @@ snapshots: '@unocss/transformer-compile-class': 66.0.0 '@unocss/transformer-directives': 66.0.0 '@unocss/transformer-variant-group': 66.0.0 - '@unocss/vite': 66.0.0(vite@6.1.0(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0))(vue@3.5.13(typescript@5.7.3)) + '@unocss/vite': 66.0.0(vite@6.1.1(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0))(vue@3.5.13(typescript@5.7.3)) optionalDependencies: - vite: 6.1.0(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0) + vite: 6.1.1(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0) transitivePeerDependencies: - postcss - supports-color - vue + unpic@4.1.2: {} + unplugin-utils@0.2.4: dependencies: pathe: 2.0.3 @@ -7929,10 +8001,10 @@ snapshots: '@types/unist': 3.0.3 vfile-message: 4.0.2 - vite@6.1.0(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0): + vite@6.1.1(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0): dependencies: esbuild: 0.24.2 - postcss: 8.5.2 + postcss: 8.5.3 rollup: 4.34.8 optionalDependencies: '@types/node': 22.13.4 @@ -7942,9 +8014,9 @@ snapshots: terser: 5.37.0 yaml: 2.7.0 - vitefu@1.0.5(vite@6.1.0(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0)): + vitefu@1.0.5(vite@6.1.1(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0)): optionalDependencies: - vite: 6.1.0(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0) + vite: 6.1.1(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0) volar-service-css@0.0.62(@volar/language-service@2.4.11): dependencies: @@ -8165,7 +8237,7 @@ snapshots: yoctocolors@2.1.1: {} - zod-to-json-schema@3.24.1(zod@3.24.2): + zod-to-json-schema@3.24.2(zod@3.24.2): dependencies: zod: 3.24.2 diff --git a/src/config.ts b/src/config.ts index 426bf8c..967cd81 100644 --- a/src/config.ts +++ b/src/config.ts @@ -92,10 +92,10 @@ export const themeConfig: ThemeConfig = { preload: { commentURL: '', // https://comment.example.com imageHostURL: 'https://image.radishzz.cc', // https://image.example.com - // If you proxy analytics requests to the custom domain, you can fill in below - customGoogleAnalyticsURL: '', // https://custom.example.com - customUmamiAnalyticsURL: '', // https://custom.example.com - customUmamiAnalyticsJS: '', // https://custom.example.com/custom.js + // If you proxy analytics JavaScript to the custom domain, you can fill in below. + // See more at https://gist.github.com/xiaopc/0602f06ca465d76bd9efd3dda9393738 and https://github.com/umami-software/umami/discussions/1026 + customGoogleAnalyticsJS: '', // https://custom.example.com/whatever.js + customUmamiAnalyticsJS: '', // https://custom.example.com/whatever.js }, // PRELOAD SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> END } diff --git a/src/content/posts/故乡.md b/src/content/posts/故乡.mdx similarity index 95% rename from src/content/posts/故乡.md rename to src/content/posts/故乡.mdx index b11b257..666165a 100644 --- a/src/content/posts/故乡.md +++ b/src/content/posts/故乡.mdx @@ -3,8 +3,11 @@ title: 故鄉 published: 2024-01-10 tags: ["鲁迅"] --- +import { Image } from 'astro:assets'; - +一只猫在阳光下睡觉。 + +![](https://image.radishzz.cc/image/gallery/03.webp) 我冒了嚴寒,回到相隔二千餘里,別了二十餘年的故鄉去。 @@ -16,9 +19,9 @@ tags: ["鲁迅"] 我這次是專為了別他而來的。我們多年聚族而居的老屋,已經公同賣給別姓了,交屋的期限,只在本年,所以必須趕在正月初一以前,永別了熟識的老屋,而且遠離了熟識的故鄉,搬家到我在謀食的異地去。 - +第二日清早晨我到了我家的門口了。瓦楞上許多枯草的斷莖當風抖著,正在說明這老屋難免易主的原因。幾房的本家大約已經搬走了,所以很寂靜。我到了自家的房外,我的母親早已迎著出來了,接著便飛出了八歲的侄兒宏兒。 --> - +一九二一年一月 diff --git a/src/layouts/Head.astro b/src/layouts/Head.astro index 010bf2f..840ff36 100644 --- a/src/layouts/Head.astro +++ b/src/layouts/Head.astro @@ -15,7 +15,7 @@ const initMetaTheme = mode === 'dark' ? darkMode : lightMode const { locale, moreLocale } = themeConfig.global const { verification = {}, twitterID = '', googleAnalyticsID = '', umamiAnalyticsID = '' } = themeConfig.seo ?? {} const { google = '', bing = '', yandex = '', baidu = '' } = verification -const { commentURL = '', imageHostURL = '', customGoogleAnalyticsURL = '', customUmamiAnalyticsURL = '', customUmamiAnalyticsJS = '' } = themeConfig.preload +const { commentURL = '', imageHostURL = '', customGoogleAnalyticsJS = '', customUmamiAnalyticsJS = '' } = themeConfig.preload --- @@ -34,10 +34,10 @@ const { commentURL = '', imageHostURL = '', customGoogleAnalyticsURL = '', custo +{commentURL && } {commentURL && } +{imageHostURL && } {imageHostURL && } -{customGoogleAnalyticsURL && } -{customUmamiAnalyticsURL && } @@ -45,7 +45,7 @@ const { commentURL = '', imageHostURL = '', customGoogleAnalyticsURL = '', custo {[locale, ...moreLocale].map(lang => ( ))} @@ -105,12 +105,6 @@ function initTheme(doc = document) { } } -// Follow system theme changes automatically -function followSystemTheme() { - initTheme() - document.dispatchEvent(new Event('theme-changed')) -} - // Function 1: Initialize theme on first load initTheme() @@ -124,51 +118,45 @@ window .matchMedia('(prefers-color-scheme: dark)') .addEventListener('change', ({ matches: isDark }) => { localStorage.setItem('theme', isDark ? 'dark' : 'light') - followSystemTheme() + initTheme() + document.dispatchEvent(new Event('theme-changed')) }) -{ - googleAnalyticsID && ( - <> - - - ) -} - - -{ - umamiAnalyticsID && ( +{googleAnalyticsID && ( + <> + +)} + + +{umamiAnalyticsID && ( +