Skip to content

Commit

Permalink
content meta
Browse files Browse the repository at this point in the history
  • Loading branch information
blackmann committed Feb 7, 2024
1 parent eccdbc3 commit 177e97f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
3 changes: 2 additions & 1 deletion client/app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import "@unocss/reset/tailwind.css";
import "./style.css";

import { cssBundleHref } from "@remix-run/css-bundle";
import type { LinksFunction, LoaderFunctionArgs } from "@remix-run/node";
import type { LinksFunction, LoaderFunctionArgs, MetaFunction } from "@remix-run/node";
import {
Links,
LiveReload,
Expand Down Expand Up @@ -49,6 +49,7 @@ export default function App() {
content="width=device-width,initial-scale=1,maximum-scale=1"
/>
<link rel="manifest" href="/manifest.webmanifest" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<Meta />
<Links />
</head>
Expand Down
8 changes: 7 additions & 1 deletion client/app/routes/discussions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@ export const action = async ({ request }: ActionFunctionArgs) => {
};

export const meta: MetaFunction<typeof loader> = ({ data }) => {
return [{ title: `Discussions | ${data?.school.shortName} | compa` }];
return [
{ title: `Discussions | ${data?.school.shortName} | compa` },
{
name: "description",
content: `Find out about all the conversations going on in ${data?.school.shortName}. Share ideas and learn from each other.`,
},
];
};

export default function Discussions() {
Expand Down
8 changes: 7 additions & 1 deletion client/app/routes/discussions_.$id.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,13 @@ async function updatePostProps(postId: number) {
}

export const meta: MetaFunction<typeof loader> = ({ data }) => {
return [{ title: `Discussions | ${data?.schoolName} | compa` }];
const summary = data?.post.content.substring(0, 72);
const description = [`Post from @${data?.post.user.username}: ${summary}…`];

return [
{ title: `Discussions | ${data?.schoolName} | compa` },
{ name: "description", content: description },
];
};

export default function Discussion() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,12 @@ export const action = async ({ request, params }: ActionFunctionArgs) => {
};

export const meta: MetaFunction<typeof loader> = ({ data }) => {
return [{ title: `Timetable | ${data?.school.shortName} | compa` }];
const description = `See timetable for ${data?.programme}, L${data?.level} for the year ${data?.year}`;

return [
{ title: `Timetable | ${data?.school.shortName} | compa` },
{ name: "description", content: description },
];
};

export default function TimeTable() {
Expand Down

0 comments on commit 177e97f

Please sign in to comment.