feat: dont show image duplicate in beginnign of markdown

This commit is contained in:
2025-01-26 02:00:59 +01:00
parent 6a54bdeec6
commit d450f4ed42
8 changed files with 99 additions and 42 deletions

View File

@ -2,7 +2,7 @@ import { PageProps, RouteContext } from "$fresh/server.ts";
import { MainLayout } from "@components/layouts/main.tsx";
import { getMovie, Movie } from "@lib/resource/movies.ts";
import { HashTags } from "@components/HashTags.tsx";
import { renderMarkdown } from "@lib/documents.ts";
import { removeImage, renderMarkdown } from "@lib/documents.ts";
import { KMenu } from "@islands/KMenu.tsx";
import { RedirectSearchHandler } from "@islands/Search.tsx";
import { Recommendations } from "@islands/Recommendations.tsx";
@ -17,9 +17,15 @@ export default async function Greet(
const movie = await getMovie(ctx.params.name);
const session = ctx.state.session;
if (!movie) {
return ctx.renderNotFound();
}
const { author = "", date = "" } = movie.meta;
const content = renderMarkdown(movie.description || "");
const content = renderMarkdown(
removeImage(movie.description || "", movie.meta.image),
);
return (
<MainLayout url={props.url} title={`Movie > ${movie.name}`} context={movie}>