feat: dont show image duplicate in beginnign of markdown
This commit is contained in:
@@ -5,7 +5,7 @@ import { KMenu } from "@islands/KMenu.tsx";
|
||||
import { YoutubePlayer } from "@components/Youtube.tsx";
|
||||
import { HashTags } from "@components/HashTags.tsx";
|
||||
import { isYoutubeLink } from "@lib/string.ts";
|
||||
import { renderMarkdown } from "@lib/documents.ts";
|
||||
import { removeImage, renderMarkdown } from "@lib/documents.ts";
|
||||
import { RedirectSearchHandler } from "@islands/Search.tsx";
|
||||
import PageHero from "@components/PageHero.tsx";
|
||||
import { Star } from "@components/Stars.tsx";
|
||||
@@ -14,6 +14,9 @@ import { MetaTags } from "@components/MetaTags.tsx";
|
||||
export const handler: Handlers<{ article: Article; session: unknown }> = {
|
||||
async GET(_, ctx) {
|
||||
const article = await getArticle(ctx.params.name);
|
||||
if (!article) {
|
||||
return ctx.renderNotFound();
|
||||
}
|
||||
return ctx.render({ article, session: ctx.state.session });
|
||||
},
|
||||
};
|
||||
@@ -25,7 +28,9 @@ export default function Greet(
|
||||
|
||||
const { author = "", date = "" } = article.meta;
|
||||
|
||||
const content = renderMarkdown(article.content);
|
||||
const content = renderMarkdown(
|
||||
removeImage(article.content, article.meta.image),
|
||||
);
|
||||
|
||||
return (
|
||||
<MainLayout
|
||||
|
@@ -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}>
|
||||
|
@@ -60,14 +60,13 @@ function ValidRecipe({
|
||||
);
|
||||
}
|
||||
|
||||
export default function Greet(
|
||||
export default function Page(
|
||||
props: PageProps<{ recipe: Recipe; session: Record<string, string> }>,
|
||||
) {
|
||||
const { recipe, session } = props.data;
|
||||
|
||||
const portion = recipe.meta?.portion;
|
||||
const amount = useSignal(portion || 1);
|
||||
console.log({ recipe });
|
||||
|
||||
const subline = [
|
||||
recipe?.meta?.time && `Duration ${recipe.meta.time}`,
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { Handlers, PageProps } from "$fresh/server.ts";
|
||||
import { MainLayout } from "@components/layouts/main.tsx";
|
||||
import { HashTags } from "@components/HashTags.tsx";
|
||||
import { renderMarkdown } from "@lib/documents.ts";
|
||||
import { removeImage, renderMarkdown } from "@lib/documents.ts";
|
||||
import { getSeries, Series } from "@lib/resource/series.ts";
|
||||
import { RedirectSearchHandler } from "@islands/Search.tsx";
|
||||
import { KMenu } from "@islands/KMenu.tsx";
|
||||
@@ -12,6 +12,10 @@ import { MetaTags } from "@components/MetaTags.tsx";
|
||||
export const handler: Handlers<{ serie: Series; session: unknown }> = {
|
||||
async GET(_, ctx) {
|
||||
const serie = await getSeries(ctx.params.name);
|
||||
|
||||
if (!serie) {
|
||||
return ctx.renderNotFound();
|
||||
}
|
||||
return ctx.render({ serie, session: ctx.state.session });
|
||||
},
|
||||
};
|
||||
@@ -23,7 +27,9 @@ export default function Greet(
|
||||
|
||||
const { author = "", date = "" } = serie.meta;
|
||||
|
||||
const content = renderMarkdown(serie.description || "");
|
||||
const content = renderMarkdown(
|
||||
removeImage(serie.description || "", serie.meta.image),
|
||||
);
|
||||
|
||||
return (
|
||||
<MainLayout url={props.url} title={`Serie > ${serie.name}`} context={serie}>
|
||||
|
Reference in New Issue
Block a user