(fix) prerenderer error

This commit is contained in:
kakkokari-gtyih 2023-09-23 19:07:45 +09:00
parent 24349378a2
commit 654f3d158e
9 changed files with 45 additions and 31 deletions

View File

@ -1,6 +1,6 @@
<script setup lang="ts">
import ExtIco from 'bi/box-arrow-up-right.svg';
import { $URL, isRelative, joinURL, cleanDoubleSlashes } from 'ufo';
import { $URL, isRelative, joinURL } from 'ufo';
const runtimeConfig = useRuntimeConfig();
const rootDomain = new $URL(runtimeConfig.public.baseUrl);

View File

@ -1,29 +1,29 @@
<template>
<RealNuxtLink v-bind="props">
<NuxtLink
v-bind="rawProps"
:to="realHref"
>
<slot></slot>
</RealNuxtLink>
</NuxtLink>
</template>
<script setup lang="ts">
import { cleanDoubleSlashes } from 'ufo';
import { parseURL, cleanDoubleSlashes, withTrailingSlash } from 'ufo';
import { NuxtLinkProps } from 'nuxt/app';
const rawProps = defineProps();
const props = ref<NuxtLinkProps>(Object.assign({}, rawProps));
const rawProps = defineProps<NuxtLinkProps>();
const realHref = ref(rawProps.to ?? rawProps.href);
if (props.value.to && typeof props.value.to === 'string') {
props.value.to = cleanDoubleSlashes(props.value.to);
if (realHref.value && typeof realHref.value === 'string') {
const runtimeConfig = useRuntimeConfig();
const rootDomain = parseURL(runtimeConfig.public.baseUrl);
const url = parseURL(realHref.value);
if (!url.host || rootDomain.host === url.host) {
realHref.value = withTrailingSlash(realHref.value, true);
}
if (props.value.href && typeof props.value.href === 'string') {
props.value.href = cleanDoubleSlashes(props.value.href);
realHref.value = cleanDoubleSlashes(realHref.value);
}
const RealNuxtLink = defineNuxtLink({
trailingSlash: "append",
});
</script>
<style scoped>
</style>

View File

@ -3,15 +3,15 @@
<h2 class="mb-12 text-2xl lg:text-3xl text-center font-bold font-title">{{ $t('_landing._sponsors.title') }}</h2>
<div class="mx-auto max-w-[240px] space-y-8 [&>*]:block">
<!-- スポンサーを入れるときはリンクとアイコンを適当に並べるだけでいい感じになります -->
<NuxtLink to="https://rss3.io/" target="_blank">
<GNuxtLink to="https://rss3.io/" target="_blank">
<img src="/img/sponsors/rss3.svg" />
</NuxtLink>
<NuxtLink to="https://skeb.jp/" target="_blank">
</GNuxtLink>
<GNuxtLink to="https://skeb.jp/" target="_blank">
<img src="/img/sponsors/skeb.svg" />
</NuxtLink>
<NuxtLink to="https://www.dotchain.ltd/advirth" target="_blank">
</GNuxtLink>
<GNuxtLink to="https://www.dotchain.ltd/advirth" target="_blank">
<img src="/img/sponsors/dcadvirth.png" />
</NuxtLink>
</GNuxtLink>
</div>
</div>
</template>

View File

@ -1,6 +1,6 @@
<template>
<div class="border border-gray-300 dark:border-gray-800 dark:bg-slate-800 rounded-lg shadow-lg overflow-hidden focus-within:ring-2 ring-accent-500 ring-offset-2">
<NuxtLink :to="`https://${instance.url}`" target="_blank">
<GNuxtLink :to="`https://${instance.url}`" target="_blank">
<div class="relative aspect-video bg-gray-200 dark:bg-gray-600">
<img v-if="instance.banner" :src="`https://instanceapp.misskey.page/instance-banners/${instance.url}.webp`" class="w-full h-full object-cover" />
<img v-else-if="instance.background" :src="`https://instanceapp.misskey.page/instance-backgrounds/${instance.url}.webp`" class="w-full h-full object-cover" />
@ -31,7 +31,7 @@
</dl>
</div>
</div>
</NuxtLink>
</GNuxtLink>
</div>
</template>

View File

@ -4,6 +4,7 @@ import en from '@/locales/en-US.yml';
export default defineI18nConfig(() => ({
legacy: false,
locale: 'ja',
fallbackLocale: 'ja',
messages: {
ja,
en,

View File

@ -17,7 +17,7 @@
</GHero>
<div class="pb-12 lg:mt-12 pt-6 bg-white dark:bg-slate-950">
<div class="container mx-auto max-w-screen-lg px-6 space-y-4 lg:space-y-2">
<NuxtLink
<GNuxtLink
class="block p-4 rounded-lg border border-slate-200 dark:border-accent-900 transition-colors hover:bg-slate-100 dark:hover:bg-slate-800"
v-for="item in data"
:key="item._path"
@ -25,7 +25,7 @@
>
<h3 class="text-lg font-bold mb-2">{{ item.navTitle || item.title }}</h3>
<p class="text-sm">{{ item.date ? $d(new Date(item.date)) : '' }}</p>
</NuxtLink>
</GNuxtLink>
</div>
</div>
</div>

View File

@ -33,7 +33,7 @@
]" />
<Tip>
<p class="mb-2">{{ $t('_brandAssets.license') }}</p>
<NuxtLink class="inline-block" to="http://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank"><img src="https://licensebuttons.net/l/by-nc-sa/4.0/88x31.png" /></NuxtLink>
<GNuxtLink class="inline-block" to="http://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank"><img src="https://licensebuttons.net/l/by-nc-sa/4.0/88x31.png" /></GNuxtLink>
</Tip>
<div id="logo">
<h2 class="text-2xl lg:text-3xl font-bold mb-4">{{ $t(`_brandAssets.logo`) }}</h2>

View File

@ -5,7 +5,7 @@
<template #description>
{{ $t('_servers.description') }}<br>
<I18nT keypath="_servers.addYourServer" tag="span">
<NuxtLink class="font-bold hover:underline underline-offset-4" to="https://github.com/joinmisskey/api">{{ $t('_servers.addYourServerLink') }}</NuxtLink>
<GNuxtLink class="font-bold hover:underline underline-offset-4" to="https://github.com/joinmisskey/api">{{ $t('_servers.addYourServerLink') }}</GNuxtLink>
</I18nT>
</template>
<template #icon>

13
pages/test.vue Normal file
View File

@ -0,0 +1,13 @@
<template>
<div>
<GNuxtLink :to="localePath('/docs///')">Link</GNuxtLink>
</div>
</template>
<script setup lang="ts">
const localePath = useLocalePath();
</script>
<style scoped>
</style>