mirror of
https://github.com/afoim/fuwari.git
synced 2026-01-31 09:03:18 +08:00
fix: 更新站点域名并修复许可证链接动态更新问题
- 将站点域名从 blog.2b2x.cn 更新为 2x.nz - 添加脚本动态更新许可证组件中的链接,确保与当前页面URL同步
This commit is contained in:
@@ -33,7 +33,7 @@ export default defineConfig({
|
|||||||
image: {
|
image: {
|
||||||
service: passthroughImageService()
|
service: passthroughImageService()
|
||||||
},
|
},
|
||||||
site: "https://blog.2b2x.cn",
|
site: "https://2x.nz",
|
||||||
base: "/",
|
base: "/",
|
||||||
trailingSlash: "always",
|
trailingSlash: "always",
|
||||||
output: "static",
|
output: "static",
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ const postUrl = decodeURIComponent(Astro.url.toString());
|
|||||||
<div class="transition font-bold text-black/75 dark:text-white/75">
|
<div class="transition font-bold text-black/75 dark:text-white/75">
|
||||||
{title}
|
{title}
|
||||||
</div>
|
</div>
|
||||||
<a href={postUrl} class="link text-[var(--primary)]">
|
<a href={postUrl} class="license-url link text-[var(--primary)]">
|
||||||
{postUrl}
|
{postUrl}
|
||||||
</a>
|
</a>
|
||||||
<div class="flex gap-6 mt-2">
|
<div class="flex gap-6 mt-2">
|
||||||
@@ -40,3 +40,29 @@ const postUrl = decodeURIComponent(Astro.url.toString());
|
|||||||
</div>
|
</div>
|
||||||
<Icon name="fa6-brands:creative-commons" class="transition text-[15rem] absolute pointer-events-none right-6 top-1/2 -translate-y-1/2 text-black/5 dark:text-white/5"></Icon>
|
<Icon name="fa6-brands:creative-commons" class="transition text-[15rem] absolute pointer-events-none right-6 top-1/2 -translate-y-1/2 text-black/5 dark:text-white/5"></Icon>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function updateLicenseUrl() {
|
||||||
|
const licenseUrls = document.querySelectorAll('.license-url');
|
||||||
|
if (licenseUrls.length === 0) return;
|
||||||
|
const currentUrl = decodeURIComponent(window.location.href);
|
||||||
|
licenseUrls.forEach(link => {
|
||||||
|
link.setAttribute('href', currentUrl);
|
||||||
|
link.textContent = currentUrl;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const setup = () => {
|
||||||
|
updateLicenseUrl();
|
||||||
|
// @ts-ignore
|
||||||
|
window.swup.hooks.on("page:view", updateLicenseUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
if (window.swup) {
|
||||||
|
setup();
|
||||||
|
} else {
|
||||||
|
document.addEventListener("swup:enable", setup);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user