Build PROMPT media library with masonry UI and persistent PostgreSQL S3 storage
PROMPT CI and deployment / verify-and-deploy (push) Successful in 8m18s
PROMPT CI and deployment / verify-and-deploy (push) Successful in 8m18s
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import type { GetServerSideProps } from "next";
|
||||
import { Feed } from "@/components/Feed";
|
||||
import { feed } from "@/lib/library";
|
||||
import { validSection } from "@/lib/model";
|
||||
export default Feed;
|
||||
export const getServerSideProps:GetServerSideProps=async({params,query})=>{
|
||||
const section=String(params?.section||'');const item=validSection(section);if(!item)return {notFound:true};
|
||||
const tagPath=Array.isArray(params?.taxonomy)?params.taxonomy.join('/'):'';
|
||||
try{return {props:{initial:await feed({kind:item.kind,path:tagPath,q:String(query.q||'').slice(0,200)}),section,tagPath}};}
|
||||
catch(e){if(e instanceof Error&&e.message==='Tag not found')return {notFound:true};return {props:{initial:{posts:[],tags:[],contributions:[],nextCursor:null,unavailable:true},section,tagPath}};}
|
||||
};
|
||||
Reference in New Issue
Block a user