mirror of
https://github.com/better-auth/better-auth.git
synced 2026-05-25 08:31:37 -05:00
feat(blog): add draft support for blog posts and update image URLs
This commit is contained in:
committed by
Alex Yang
parent
feb83a7ba3
commit
58c71273b0
@@ -2,6 +2,7 @@
|
||||
title: "Better Auth 1.5"
|
||||
description: "Auth CLI, MCP Auth, OAuth 2.1 Provider, Electron integration, i18n, adapter extraction, dynamic base URL, Cloudflare D1 support, CLI init wizard, seat-based billing, SAML Single Logout, test utilities, secret key rotation, and more!"
|
||||
date: 2026-02-28
|
||||
draft: true
|
||||
author:
|
||||
name: "Alex Yang"
|
||||
avatar: "/avatars/alex.png"
|
||||
|
||||
@@ -21,9 +21,14 @@ function formatDate(date: Date) {
|
||||
}
|
||||
|
||||
function BlogList() {
|
||||
const posts = blogs.getPages().sort((a, b) => {
|
||||
return new Date(b.data.date).getTime() - new Date(a.data.date).getTime();
|
||||
});
|
||||
const posts = blogs
|
||||
.getPages()
|
||||
.filter((p) => !p.data.draft)
|
||||
.sort((a, b) => {
|
||||
return (
|
||||
new Date(b.data.date).getTime() - new Date(a.data.date).getTime()
|
||||
);
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="flex flex-col lg:flex-row h-full min-h-dvh pt-14 lg:pt-0">
|
||||
@@ -114,7 +119,7 @@ export default async function Page({
|
||||
}
|
||||
|
||||
const page = blogs.getPage(slug);
|
||||
if (!page) {
|
||||
if (!page || page.data.draft) {
|
||||
notFound();
|
||||
}
|
||||
|
||||
@@ -271,7 +276,7 @@ export async function generateMetadata({
|
||||
};
|
||||
}
|
||||
const page = blogs.getPage(slug);
|
||||
if (!page) return notFound();
|
||||
if (!page || page.data.draft) return notFound();
|
||||
const { title, description, image } = page.data;
|
||||
return {
|
||||
title,
|
||||
@@ -289,5 +294,8 @@ export async function generateMetadata({
|
||||
}
|
||||
|
||||
export function generateStaticParams() {
|
||||
return blogs.generateParams();
|
||||
return blogs
|
||||
.getPages()
|
||||
.filter((p) => !p.data.draft)
|
||||
.map((p) => ({ slug: p.slugs }));
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ export default async function HomePage() {
|
||||
{/* Dark mode logos */}
|
||||
<div className="group max-w-[300px] w-full max-h-[200px] -mt-[30%] hidden dark:flex justify-center opacity-60">
|
||||
<Image
|
||||
src="/left-3d-logo.svg"
|
||||
src="https://docs.better-auth.com/left-3d-logo.svg"
|
||||
alt=""
|
||||
width={518}
|
||||
height={667}
|
||||
@@ -29,7 +29,7 @@ export default async function HomePage() {
|
||||
draggable={false}
|
||||
/>
|
||||
<Image
|
||||
src="/right-3d-logo.svg"
|
||||
src="https://docs.better-auth.com/right-3d-logo.svg"
|
||||
alt=""
|
||||
width={518}
|
||||
height={667}
|
||||
@@ -41,7 +41,7 @@ export default async function HomePage() {
|
||||
{/* Light mode logos */}
|
||||
<div className="group max-w-[300px] w-full max-h-[200px] -mt-[30%] flex dark:hidden justify-center opacity-60">
|
||||
<Image
|
||||
src="/left-3d-logo-light.svg"
|
||||
src="https://docs.better-auth.com/left-3d-logo-light.svg"
|
||||
alt=""
|
||||
width={518}
|
||||
height={667}
|
||||
@@ -50,7 +50,7 @@ export default async function HomePage() {
|
||||
draggable={false}
|
||||
/>
|
||||
<Image
|
||||
src="/right-3d-logo-light.svg"
|
||||
src="https://docs.better-auth.com/right-3d-logo-light.svg"
|
||||
alt=""
|
||||
width={518}
|
||||
height={667}
|
||||
|
||||
@@ -20,6 +20,7 @@ export const blogCollection = defineCollections({
|
||||
title: z.string(),
|
||||
description: z.string(),
|
||||
date: z.date(),
|
||||
draft: z.boolean().optional(),
|
||||
author: z
|
||||
.object({
|
||||
name: z.string(),
|
||||
|
||||
@@ -1522,7 +1522,7 @@ export const auth = betterAuth({
|
||||
return;
|
||||
}
|
||||
if (connectResponse.connect) {
|
||||
await open("https://beta.better-auth.com/onboarding");
|
||||
await open("https://better-auth.com/onboarding");
|
||||
console.log(
|
||||
chalk.cyan("\n→ ") +
|
||||
"Opening Better Auth onboarding in your browser...\n",
|
||||
|
||||
Reference in New Issue
Block a user