This commit is contained in:
2026-01-03 22:32:33 +08:00
parent d684bf849e
commit f639814876
7 changed files with 112 additions and 9 deletions

View File

@@ -1,4 +1,6 @@
const siteConfig = {
import type { SiteConfig } from "~/types/nav";
const siteConfig: SiteConfig = {
siteMeta: {
title: "RhenCloud's Blog",
description: "一个普普通通的技术博客,分享技术,记录日常,传递一些有趣的想法。",

View File

@@ -1,9 +1,18 @@
<script setup>
import { useRoute } from "vue-router";
import TechInfo from "~/components/main/TechInfo.vue";
import siteConfig from "~/config";
const route = useRoute();
const { data: content } = await useAsyncData(route.path, () => queryCollection("about").first());
useHead({
title: `About - ${siteConfig.siteMeta.title}`,
meta: [
{ name: "description", content: siteConfig.siteMeta.description },
{ name: "author", content: siteConfig.siteMeta.author },
],
});
</script>
<template>

View File

@@ -27,7 +27,7 @@ const formattedData = computed(() => {
path: articles.path,
title: articles.title || "no-title available",
description: articles.description || "no-description available",
image: articles.image || "/blogs-img/blog.jpg",
image: articles.image || getRandomFallbackImage(),
alt: articles.alt || "no alter data available",
date: articles.date || "not-date-available",
tags: articles.tags || [],
@@ -39,7 +39,7 @@ const formattedData = computed(() => {
});
useHead({
title: category.value,
title: `Category: ${category.value}`,
meta: [
{
name: "description",

View File

@@ -28,9 +28,9 @@ const data = computed<BlogPost>(() => {
});
useHead({
title: siteConfig.siteMeta.title || "",
title: `${data.value.title} - ${siteConfig.siteMeta.title}`,
meta: [
{ name: "description", content: siteConfig.siteMeta.description },
{ name: "description", content: data.value.description },
{ name: "author", content: siteConfig.siteMeta.author },
],
link: [

View File

@@ -29,7 +29,7 @@ const formattedData = computed(() => {
path: articles.path,
title: articles.title || "no-title available",
description: articles.description || "no-description available",
image: articles.image || "/blogs-img/blog.jpg",
image: articles.image || getRandomFallbackImage(),
alt: articles.alt || "no alter data available",
date: formatDate(articles.date) || "not-date-available",
tags: articles.tags || [],

View File

@@ -1,6 +1,4 @@
<script lang="ts" setup>
import siteConfig from "~/config";
const { data } = await useAsyncData("all-blog-post-by-tags", () =>
queryCollection("content").select("path", "tags").where("published", "=", true).all(),
);
@@ -20,7 +18,7 @@ data.value?.forEach((blog) => {
});
useHead({
title: `${siteConfig.siteMeta.title} - Tags`,
title: "Tags",
meta: [
{
name: "description",

94
app/types/nav.ts Normal file
View File

@@ -0,0 +1,94 @@
export interface NavLink {
name: string;
path: string;
icon?: string;
children?: NavLink[];
}
export interface SiteMeta {
title: string;
description?: string;
keywords?: string[];
author?: string;
url?: string;
email?: string;
lang?: string;
favicon?: string;
startTime?: string;
}
export interface TypedOptions {
enable: boolean;
typeSpeed?: number;
backSpeed?: number;
loop?: boolean;
backDelay?: number;
}
export interface Hero {
title?: string;
description?: string | string[];
typed?: TypedOptions;
}
export interface Profile {
avatar?: string;
birthday?: string;
}
export interface SocialLink {
name: string;
url: string;
}
export interface LineInfo {
name: string;
url: string;
ping?: boolean;
}
export interface Theme {
background?: string;
backgroundMobile?: string;
color?: string;
}
export interface Footer {
beian?: string;
beianLink?: string;
customHtml?: string;
hitokoto?: {
enable: boolean;
type?: string;
};
}
export interface CommentConfig {
twikoo?: {
enable?: boolean;
envId?: string;
};
}
export interface UmamiConfig {
enable?: boolean;
scriptUrl?: string;
apiKey?: string;
websiteId?: string;
apiEndpoint?: string;
}
export interface SiteConfig {
siteMeta: SiteMeta;
hero: Hero;
profile: Profile;
socialLinks: SocialLink[];
navbar: {
links: NavLink[];
};
lines?: LineInfo[];
theme?: Theme;
footer?: Footer;
comment?: CommentConfig;
umami?: UmamiConfig;
}