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 \
|
||||
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 { author = "", date = "", articleBody = "" } = article?.content || {};
|
||||
const { author = "", date = "", articleBody = "" } = (article?.content || {});
|
||||
|
||||
const content = renderMarkdown(
|
||||
removeImage(articleBody, article.content.image),
|
||||
|
||||
@@ -13,7 +13,7 @@ import { fetchResource } from "@lib/resources.ts";
|
||||
|
||||
export const handler: Handlers<{ serie: Series; session: unknown }> = {
|
||||
async GET(_, ctx) {
|
||||
const serie = await fetchResource(`series/${ctx.params.name}`);
|
||||
const serie = await fetchResource(`series/${ctx.params.name}.md`);
|
||||
|
||||
if (!serie) {
|
||||
return ctx.renderNotFound();
|
||||
@@ -27,23 +27,23 @@ export default function Greet(
|
||||
) {
|
||||
const { serie, session } = props.data;
|
||||
|
||||
const { author = "", date = "" } = serie.content;
|
||||
const { author = "", date = "" } = (serie?.content || {});
|
||||
|
||||
const content = renderMarkdown(
|
||||
removeImage(serie.description || "", serie.content.image),
|
||||
removeImage(serie.description || "", serie.content?.image),
|
||||
);
|
||||
|
||||
return (
|
||||
<MainLayout
|
||||
url={props.url}
|
||||
title={`Serie > ${serie.content.name}`}
|
||||
title={`Serie > ${serie.content?.name}`}
|
||||
context={serie}
|
||||
>
|
||||
<RedirectSearchHandler />
|
||||
<KMenu type="main" context={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.BackLink href="/series" />
|
||||
{session && (
|
||||
@@ -63,9 +63,9 @@ export default function Greet(
|
||||
date.toString(),
|
||||
]}
|
||||
>
|
||||
{serie.content.reviewRating && (
|
||||
{serie.content?.reviewRating && (
|
||||
<Star
|
||||
rating={parseRating(serie.content.reviewRating.ratingValue)}
|
||||
rating={parseRating(serie.content?.reviewRating?.ratingValue)}
|
||||
/>
|
||||
)}
|
||||
</PageHero.Subline>
|
||||
@@ -74,7 +74,7 @@ export default function Greet(
|
||||
{serie.content?.tags?.length > 0 && (
|
||||
<>
|
||||
<br />
|
||||
<HashTags tags={serie.content.tags} />
|
||||
<HashTags tags={serie.content?.tags} />
|
||||
</>
|
||||
)}
|
||||
<div class="px-8 text-white mt-10">
|
||||
|
||||
Reference in New Issue
Block a user