Skip to content

Commit

Permalink
Add link tags to RSS feeds
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiodxa committed Jan 21, 2024
1 parent 0e94ebe commit bb617e6
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ function Document({
/>
<Meta />
<Links />
<link rel="alternate" type="application/rss+xml" href="/rss" />
{/* <link rel="alternate" type="application/json" href="/feed.json" /> */}
{/* <link rel="alternate" type="application/mf2+html" href="/feed.html" /> */}
<link href="https://github.com/sergiodxa" rel="me authn" />
<link
rel="webmention"
Expand Down
7 changes: 7 additions & 0 deletions app/routes/_layout.articles/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ export async function loader({ request, context }: LoaderFunctionArgs) {
meta.push({ title: t("articles.meta.title.search", { term }) });
}

meta.push({
tagName: "link",
rel: "alternate",
type: "application/rss+xml",
href: "/articles.rss",
});

return json({ term: term ?? undefined, meta, articles }, { headers });
} catch (error) {
if (error instanceof Error) {
Expand Down
10 changes: 9 additions & 1 deletion app/routes/_layout.bookmarks/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,15 @@ export function loader({ request, context }: LoaderFunctionArgs) {
async meta(): Promise<MetaDescriptor[]> {
let t = await new I18n().getFixedT(request);

return [{ title: t("bookmarks.meta.title") }];
return [
{ title: t("bookmarks.meta.title") },
{
tagName: "link",
rel: "alternate",
type: "application/rss+xml",
href: "/bookmarks.rss",
},
];
},
});
});
Expand Down
7 changes: 7 additions & 0 deletions app/routes/_layout.tutorials/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ export function loader({ request, context }: LoaderFunctionArgs) {
});
}

meta.push({
tagName: "link",
rel: "alternate",
type: "application/rss+xml",
href: "/tutorials.rss",
});

return meta;
},
},
Expand Down

0 comments on commit bb617e6

Please sign in to comment.