Compare commits
4 Commits
60d8ad8e8a
...
d7c84ea0ce
| Author | SHA1 | Date | |
|---|---|---|---|
| d7c84ea0ce | |||
| 4d30605872 | |||
| fbc12f97db | |||
| 5d62fd89b9 |
@@ -61,6 +61,7 @@ export class BlogController {
|
||||
return {
|
||||
id: blog.id,
|
||||
title: blog.title,
|
||||
description: blog.description,
|
||||
createdAt: blog.createdAt,
|
||||
content: blogContent,
|
||||
};
|
||||
|
||||
@@ -14,6 +14,7 @@ import { Skeleton } from "@/components/ui/skeleton";
|
||||
import { BlogComments } from "./components/BlogComments";
|
||||
import Image from "next/image";
|
||||
import { BlogAPI } from "@/lib/api/client";
|
||||
import { useEffect } from "react";
|
||||
|
||||
export default function Blog() {
|
||||
const params = useParams();
|
||||
@@ -34,6 +35,16 @@ export default function Blog() {
|
||||
() => BlogAPI.getBlog(id, password || undefined),
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
if (data) {
|
||||
document.title = `${data.title} - 特恩的日志`;
|
||||
const metaDescription = document.querySelector('meta[name="description"]');
|
||||
if (metaDescription) {
|
||||
metaDescription.setAttribute("content", data.description);
|
||||
}
|
||||
}
|
||||
}, [data]);
|
||||
|
||||
return (
|
||||
<div className="w-full overflow-x-hidden">
|
||||
<div className="max-w-200 mx-auto px-5 overflow-x-hidden mb-10">
|
||||
|
||||
@@ -24,6 +24,12 @@ const getBlogDetailUrl = (id: string): string => {
|
||||
return `/blog/${encoded}`;
|
||||
};
|
||||
|
||||
|
||||
export const metadata = {
|
||||
title: '日志 - 特恩的日志',
|
||||
description: '我随便发点,你也随便看看~',
|
||||
};
|
||||
|
||||
export default async function Blog() {
|
||||
let errorMsg = '';
|
||||
const blogs = await BlogAPI.list().catch(e => {
|
||||
|
||||
@@ -7,6 +7,11 @@ import {
|
||||
import { ResourceAPI } from "@/lib/api/server";
|
||||
import { AlertCircle } from "lucide-react";
|
||||
|
||||
export const metadata = {
|
||||
title: '资源 - 特恩的日志',
|
||||
description: '一些实用工具和学习资源',
|
||||
};
|
||||
|
||||
export default async function Resources() {
|
||||
let errorMsg = '';
|
||||
const data = await ResourceAPI.list().catch(e => { errorMsg = `${e}`; return null; });
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Geist, Geist_Mono } from "next/font/google";
|
||||
import "./globals.css";
|
||||
import { ThemeProvider } from "../components/theme-provider";
|
||||
import { metadata } from "./config/metadata";
|
||||
import { Toaster } from "sonner";
|
||||
import { UserAPI } from "@/lib/api/server";
|
||||
import { ClientProvider } from "./ClientProvider";
|
||||
import { Metadata } from "next";
|
||||
|
||||
const geistSans = Geist({
|
||||
variable: "--font-geist-sans",
|
||||
@@ -16,7 +16,10 @@ const geistMono = Geist_Mono({
|
||||
subsets: ["latin"],
|
||||
});
|
||||
|
||||
export { metadata };
|
||||
export const metadata: Metadata = {
|
||||
title: "控制台 - 特恩的日志",
|
||||
description: "登录或注册以解锁更多妙妙小工具",
|
||||
};
|
||||
|
||||
export default async function RootLayout({
|
||||
children,
|
||||
|
||||
@@ -5,6 +5,7 @@ export async function getBlog(id: string, password?: string) {
|
||||
return clientFetch<{
|
||||
id: string;
|
||||
title: string;
|
||||
description: string;
|
||||
createdAt: string;
|
||||
content: string;
|
||||
}>(`/api/blog/${id}` + (password ? `?p=${password}` : ''));
|
||||
|
||||
Reference in New Issue
Block a user