Skip to content

Commit

Permalink
feat: add help articles to sitemap
Browse files Browse the repository at this point in the history
  • Loading branch information
mfts committed Apr 24, 2024
1 parent 2129044 commit 1a5c18e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion app/sitemap.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import { getPosts, getAlternatives, getPages } from "@/lib/content";
import {
getPosts,
getAlternatives,
getPages,
getHelpArticles,
} from "@/lib/content";
import { MetadataRoute } from "next";

export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const posts = await getPosts();
const solutions = await getPages();
const alternatives = await getAlternatives();
const helpArticles = await getHelpArticles();
const blogLinks = posts.map((post) => ({
url: `https://www.papermark.io/blog/${post?.data.slug}`,
lastModified: new Date().toISOString().split("T")[0],
Expand All @@ -17,6 +23,10 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
url: `https://www.papermark.io/alternatives/${alternative?.slug}`,
lastModified: new Date().toISOString().split("T")[0],
}));
const helpArticleLinks = helpArticles.map((article) => ({
url: `https://www.papermark.io/help/article/${article?.data.slug}`,
lastModified: new Date().toISOString().split("T")[0],
}));

return [
{
Expand Down Expand Up @@ -54,5 +64,6 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
...blogLinks,
...solutionLinks,
...alternativeLinks,
...helpArticleLinks,
];
}
2 changes: 1 addition & 1 deletion lib/content/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { getAlternatives } from "./alternative";
export { getPostsRemote as getPosts } from "./blog";
export { getPages } from "./page";
export { getHelpPosts } from "./help";
export { getHelpArticles } from "./help";

0 comments on commit 1a5c18e

Please sign in to comment.