feat!: change links schema + bugfix

Changed files
+22 -15
app
+13 -9
app/app.vue
···
{
icon: "ant-design:github-filled",
title: "GitHub",
-
href: config.links.find((link) => link.name === "github")?.url
},
{
icon: "ri:mastodon-fill",
title: "Mastodon",
-
href: config.links.find((link) => link.name === "mastodon")?.url
},
{
icon: "ri:bluesky-fill",
title: "BlueSky",
-
href: config.links.find((link) => link.name === "bluesky")?.url
}
].reverse()
);
···
<Icon v-else name="ri:moon-fill" size="1.5rem" mode="svg" />
</div>
<nav :class="['flex items-start gap-4', 'text-gray-800 dark:text-gray-200', 'font-semibold']">
-
<NuxtLink v-for="item in pages" :key="item.path" :to="item.path.replace('/pages', '')">
-
{{ item.title }}
-
</NuxtLink>
</nav>
<div class="flex items-center gap-2">
-
<NuxtLink v-for="link in links" :key="link.title" :to="link.href" target="_blank" :aria-label="link.title">
-
<Icon :name="link.icon" size="2rem" :title="link.title" />
-
</NuxtLink>
</div>
</div>
</header>
···
{
icon: "ant-design:github-filled",
title: "GitHub",
+
href: config.links.github
},
{
icon: "ri:mastodon-fill",
title: "Mastodon",
+
href: config.links.mastodon
},
{
icon: "ri:bluesky-fill",
title: "BlueSky",
+
href: config.links.bluesky
}
].reverse()
);
···
<Icon v-else name="ri:moon-fill" size="1.5rem" mode="svg" />
</div>
<nav :class="['flex items-start gap-4', 'text-gray-800 dark:text-gray-200', 'font-semibold']">
+
<template v-for="item in pages" :key="item.path">
+
<NuxtLink v-if="item.title" :to="item.path.replace('/pages', '')">
+
{{ item.title }}
+
</NuxtLink>
+
</template>
</nav>
<div class="flex items-center gap-2">
+
<template v-for="link in links" :key="link.title">
+
<NuxtLink v-if="link.href" :to="link.href" target="_blank" :aria-label="link.title">
+
<Icon :name="link.icon" size="2rem" :title="link.title" />
+
</NuxtLink>
+
</template>
</div>
</div>
</header>
+9 -6
globals.ts
···
[K in keyof T]: T[K];
} & {};
export type BlogConfig = {
site: string;
tableOfContents: boolean;
-
sharingProviders: ("bluesky" | "clipboard" | "native")[];
title: string;
author: string;
meta: {
···
content: string;
}[];
links: {
-
name: "bluesky" | "github" | "mastodon";
-
url: string;
-
}[];
};
export function defineBlogConfig(config: Prettify<Partial<BlogConfig>>) {
···
acc[provider] = true;
return acc;
},
-
{} as Record<string, boolean>
)
: { bluesky: true, clipboard: true, native: true },
title: config.title ?? "My Blog",
···
meta: config.meta ?? [
{ name: "description", content: "My blog description" }
],
-
links: config.links ?? []
};
}
···
[K in keyof T]: T[K];
} & {};
+
type SharingProvider = "bluesky" | "clipboard" | "native";
+
export type BlogConfig = {
site: string;
tableOfContents: boolean;
+
sharingProviders: SharingProvider[];
title: string;
author: string;
meta: {
···
content: string;
}[];
links: {
+
bluesky?: `https://bluesky.app/profile/${string}`;
+
github?: `https://github.com/${string}`;
+
mastodon?: `https://${string}/@${string}`;
+
};
};
export function defineBlogConfig(config: Prettify<Partial<BlogConfig>>) {
···
acc[provider] = true;
return acc;
},
+
{} as Record<SharingProvider, boolean>
)
: { bluesky: true, clipboard: true, native: true },
title: config.title ?? "My Blog",
···
meta: config.meta ?? [
{ name: "description", content: "My blog description" }
],
+
links: config.links ?? {}
};
}