feat: trying to add hashes to scripts
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Handlers, PageProps } from "$fresh/server.ts";
|
||||
import { PageProps } from "fresh";
|
||||
import { MainLayout } from "@components/layouts/main.tsx";
|
||||
import { KMenu } from "@islands/KMenu.tsx";
|
||||
import { YoutubePlayer } from "@components/Youtube.tsx";
|
||||
@@ -12,19 +12,20 @@ import { MetaTags } from "@components/MetaTags.tsx";
|
||||
import { fetchResource } from "@lib/marka/index.ts";
|
||||
import { ArticleResource } from "@lib/marka/schema.ts";
|
||||
import { parseRating } from "@lib/helpers.ts";
|
||||
import { HttpError } from "fresh";
|
||||
import { define } from "../../utils.ts";
|
||||
|
||||
export const handler: Handlers<{ article: ArticleResource; session: unknown }> =
|
||||
{
|
||||
async GET(_, ctx) {
|
||||
const article = await fetchResource<ArticleResource>(
|
||||
`articles/${ctx.params.name}.md`,
|
||||
);
|
||||
if (!article) {
|
||||
return ctx.renderNotFound();
|
||||
}
|
||||
return ctx.render({ article, session: ctx.state.session });
|
||||
},
|
||||
};
|
||||
export const handler = define.handlers({
|
||||
async GET(ctx) {
|
||||
const article = await fetchResource<ArticleResource>(
|
||||
`articles/${ctx.params.name}.md`,
|
||||
);
|
||||
if (!article) {
|
||||
throw new HttpError(404);
|
||||
}
|
||||
return { data: { article, session: ctx.state.session } };
|
||||
},
|
||||
});
|
||||
|
||||
export default function Greet(
|
||||
props: PageProps<
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
import { Handlers, PageProps } from "$fresh/server.ts";
|
||||
import { PageProps } from "fresh";
|
||||
import { MainLayout } from "@components/layouts/main.tsx";
|
||||
import { type ArticleResource, GenericResource } from "@lib/marka/schema.ts";
|
||||
import { KMenu } from "@islands/KMenu.tsx";
|
||||
import { Grid } from "@components/Grid.tsx";
|
||||
import { IconArrowLeft } from "@components/icons.tsx";
|
||||
import { RedirectSearchHandler } from "@islands/Search.tsx";
|
||||
import { parseResourceUrl, searchResource } from "@lib/search.ts";
|
||||
import { ResourceCard } from "@components/Card.tsx";
|
||||
import { Link } from "@islands/Link.tsx";
|
||||
import { listResources } from "@lib/marka/index.ts";
|
||||
import { define } from "../../utils.ts";
|
||||
import { TbArrowLeft } from "@preact-icons/tb";
|
||||
|
||||
export const handler: Handlers<
|
||||
{ articles: ArticleResource[] | null; searchResults?: GenericResource[] }
|
||||
> = {
|
||||
async GET(req, ctx) {
|
||||
export const handler = define.handlers({
|
||||
async GET(ctx) {
|
||||
const req = ctx.req;
|
||||
const articles = await listResources<ArticleResource>("articles");
|
||||
const searchParams = parseResourceUrl(req.url);
|
||||
const searchResults = searchParams &&
|
||||
await searchResource({ ...searchParams, types: ["articles"] });
|
||||
return ctx.render({ articles, searchResults });
|
||||
return { data: { articles, searchResults } };
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
export default function Greet(
|
||||
export default define.page(function Greet(
|
||||
props: PageProps<
|
||||
{ articles: ArticleResource[] | null; searchResults: GenericResource[] }
|
||||
>,
|
||||
@@ -40,7 +40,7 @@ export default function Greet(
|
||||
class="px-4 ml-4 py-2 bg-gray-300 text-gray-800 rounded-lg flex items-center gap-1"
|
||||
href="/"
|
||||
>
|
||||
<IconArrowLeft class="w-5 h-5" />
|
||||
<TbArrowLeft class="w-5 h-5" />
|
||||
Back
|
||||
</Link>
|
||||
|
||||
@@ -59,4 +59,4 @@ export default function Greet(
|
||||
</Grid>
|
||||
</MainLayout>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user