-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathCurrentCommitSha.vue
28 lines (25 loc) · 981 Bytes
/
CurrentCommitSha.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<script setup lang="ts">
import { siteMeta } from '~/site/meta'
withDefaults(defineProps<{
dataRepositoryLink?: string
}>(), {
dataRepositoryLink: `https://github.com/${siteMeta.github.username}/${siteMeta.github.dataRepository}`
})
const { data: commitSha } = useLazyAsyncData(
'current-commit-sha',
() => queryContent('/latest-commit')
.findOne()
)
const githubRepo = `https://github.com/${siteMeta.github.username}/${siteMeta.github.repository}`
</script>
<template>
<span v-if="commitSha">
<span v-if="commitSha.dataRepository">
Site web <a :href="`${githubRepo}/commit/${commitSha.websiteRepository.long}`">#{{ commitSha.websiteRepository.short }}</a>.
Données <a :href="dataRepositoryLink">#{{ commitSha.dataRepository.short }}</a>.
</span>
<span v-else>
Révision <a :href="`${githubRepo}/commit/${commitSha.websiteRepository.long}`">#{{ commitSha.websiteRepository.short }}</a>.
</span>
</span>
</template>