import type {GetServerSideProps} from 'next'; import Head from 'next/head'; import {Shell} from '@/components/Shell'; import {ExploreFeed} from '@/components/ExploreFeed'; import {exploreFeed,staticEntries,type ExploreEntry} from '@/lib/explore'; export default function Home({entries,cursor,q,total,unavailable=false}:{entries:ExploreEntry[];cursor:string|null;q:string;total?:number;unavailable?:boolean}){return PROMPT · 发现{unavailable&&

素材库暂时无法连接,先看看这些公开笔记。

}
} export const getServerSideProps:GetServerSideProps=async({query})=>{const q=String(query.q||'').slice(0,200);try{const data=await exploreFeed(q);return {props:{entries:data.entries,cursor:data.nextCursor,total:data.total,q}}}catch{return {props:{entries:staticEntries.filter(e=>!q||(e.title+e.description).includes(q)),cursor:null,q,unavailable:true}}}};