fix: correctly fetch articles/series
This commit is contained in:
		| @@ -1,4 +1,4 @@ | |||||||
| FROM denoland/deno:2.3.1 AS build | FROM denoland/deno:2.5.4 AS build | ||||||
|  |  | ||||||
| RUN apt-get update && apt-get install -y --no-install-recommends \ | RUN apt-get update && apt-get install -y --no-install-recommends \ | ||||||
|     curl ffmpeg && \ |     curl ffmpeg && \ | ||||||
|   | |||||||
							
								
								
									
										600
									
								
								article.html
									
									
									
									
									
								
							
							
						
						
									
										600
									
								
								article.html
									
									
									
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @@ -27,7 +27,7 @@ export default function Greet( | |||||||
| ) { | ) { | ||||||
|   const { article, session } = props.data; |   const { article, session } = props.data; | ||||||
|  |  | ||||||
|   const { author = "", date = "", articleBody = "" } = article?.content || {}; |   const { author = "", date = "", articleBody = "" } = (article?.content || {}); | ||||||
|  |  | ||||||
|   const content = renderMarkdown( |   const content = renderMarkdown( | ||||||
|     removeImage(articleBody, article.content.image), |     removeImage(articleBody, article.content.image), | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ import { fetchResource } from "@lib/resources.ts"; | |||||||
|  |  | ||||||
| export const handler: Handlers<{ serie: Series; session: unknown }> = { | export const handler: Handlers<{ serie: Series; session: unknown }> = { | ||||||
|   async GET(_, ctx) { |   async GET(_, ctx) { | ||||||
|     const serie = await fetchResource(`series/${ctx.params.name}`); |     const serie = await fetchResource(`series/${ctx.params.name}.md`); | ||||||
|  |  | ||||||
|     if (!serie) { |     if (!serie) { | ||||||
|       return ctx.renderNotFound(); |       return ctx.renderNotFound(); | ||||||
| @@ -27,23 +27,23 @@ export default function Greet( | |||||||
| ) { | ) { | ||||||
|   const { serie, session } = props.data; |   const { serie, session } = props.data; | ||||||
|  |  | ||||||
|   const { author = "", date = "" } = serie.content; |   const { author = "", date = "" } = (serie?.content || {}); | ||||||
|  |  | ||||||
|   const content = renderMarkdown( |   const content = renderMarkdown( | ||||||
|     removeImage(serie.description || "", serie.content.image), |     removeImage(serie.description || "", serie.content?.image), | ||||||
|   ); |   ); | ||||||
|  |  | ||||||
|   return ( |   return ( | ||||||
|     <MainLayout |     <MainLayout | ||||||
|       url={props.url} |       url={props.url} | ||||||
|       title={`Serie > ${serie.content.name}`} |       title={`Serie > ${serie.content?.name}`} | ||||||
|       context={serie} |       context={serie} | ||||||
|     > |     > | ||||||
|       <RedirectSearchHandler /> |       <RedirectSearchHandler /> | ||||||
|       <KMenu type="main" context={serie} /> |       <KMenu type="main" context={serie} /> | ||||||
|  |  | ||||||
|       <MetaTags resource={serie} /> |       <MetaTags resource={serie} /> | ||||||
|       <PageHero image={serie.content.image} thumbnail={serie.content.thumbnail}> |       <PageHero image={serie.content?.image} thumbnail={serie.content?.thumbnail}> | ||||||
|         <PageHero.Header> |         <PageHero.Header> | ||||||
|           <PageHero.BackLink href="/series" /> |           <PageHero.BackLink href="/series" /> | ||||||
|           {session && ( |           {session && ( | ||||||
| @@ -63,9 +63,9 @@ export default function Greet( | |||||||
|               date.toString(), |               date.toString(), | ||||||
|             ]} |             ]} | ||||||
|           > |           > | ||||||
|             {serie.content.reviewRating && ( |             {serie.content?.reviewRating && ( | ||||||
|               <Star |               <Star | ||||||
|                 rating={parseRating(serie.content.reviewRating.ratingValue)} |                 rating={parseRating(serie.content?.reviewRating?.ratingValue)} | ||||||
|               /> |               /> | ||||||
|             )} |             )} | ||||||
|           </PageHero.Subline> |           </PageHero.Subline> | ||||||
| @@ -74,7 +74,7 @@ export default function Greet( | |||||||
|       {serie.content?.tags?.length > 0 && ( |       {serie.content?.tags?.length > 0 && ( | ||||||
|         <> |         <> | ||||||
|           <br /> |           <br /> | ||||||
|           <HashTags tags={serie.content.tags} /> |           <HashTags tags={serie.content?.tags} /> | ||||||
|         </> |         </> | ||||||
|       )} |       )} | ||||||
|       <div class="px-8 text-white mt-10"> |       <div class="px-8 text-white mt-10"> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user