Skip to content

Commit

Permalink
🦄 refactor: 原文地址取值调整
Browse files Browse the repository at this point in the history
  • Loading branch information
白云苍狗 committed Sep 6, 2024
1 parent fede6e1 commit cb98a18
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/vitepress-theme-async/components/TrmPostCopyright.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
<script setup lang="ts">
import { useData } from "vitepress";
import { onMounted, ref } from "vue";
const { theme, frontmatter, page } = useData<AsyncThemeConfig>();
const license = theme.value.creativeCommons?.license || "by-nc-sa";
const ccVersion = theme.value.creativeCommons?.license == "zero" ? "1.0" : "4.0";
const ccPrefix = theme.value.creativeCommons?.license == "zero" ? "publicdomain" : "licenses";
const ccURL = "https://creativecommons.org/" + ccPrefix + "/" + license + "/" + ccVersion + "/" + theme.value.creativeCommons?.language || "deed.zh-hans";
const link = `<a href="${ccURL}" target="_blank" rel="noopener" title="CC ${license.toUpperCase() + " " + ccVersion}">CC ${license.toUpperCase() + " " + ccVersion}</a>`;
const olink = ref<string>('')
onMounted(() => {
olink.value = page.value.frontmatter.originalLink ?? window.location.href
})
</script>
<template>
<ul v-if="theme.creativeCommons?.post" class="trm-post-copyright">
Expand All @@ -16,8 +22,8 @@ const link = `<a href="${ccURL}" target="_blank" rel="noopener" title="CC ${lice
</li>
<li class="trm-post-copyright-link">
<strong>{{ $t("post.copyright.link") }}{{ $t("symbol.colon") }}</strong>
<a id="original-link" :href="page.filePath" :title="page.title">
{{ page.filePath }}
<a id="original-link" :href="olink" :title="page.title">
{{ olink }}
</a>
</li>
<li class="trm-post-copyright-license">
Expand Down

0 comments on commit cb98a18

Please sign in to comment.