Skip to content

Commit

Permalink
Merge branch 'main' into fullscreen-preview
Browse files Browse the repository at this point in the history
  • Loading branch information
kof authored May 2, 2024
2 parents 2c1d114 + cc6dc64 commit df0e203
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 13 deletions.
4 changes: 1 addition & 3 deletions apps/builder/app/shared/$resources/sitemap.xml.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ export const loader = async ({ request }: { request: Request }) => {

const pages = parsePages(build.pages);

const allPages = [pages.homePage, ...pages.pages];

const siteMap = getStaticSiteMapXml(allPages, build.updatedAt.toISOString());
const siteMap = getStaticSiteMapXml(pages, build.updatedAt.toISOString());

return json(siteMap);
};

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/cli/src/prebuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ export const projectMeta: ProjectMeta =
join(generatedDir, "[sitemap.xml].ts"),
`
export const sitemap = ${JSON.stringify(
getStaticSiteMapXml(siteData.pages, siteData.build.updatedAt),
getStaticSiteMapXml(siteData.build.pages, siteData.build.updatedAt),
null,
2
)};
Expand Down
7 changes: 4 additions & 3 deletions packages/sdk/src/page-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,17 @@ export const getPagePath = (id: Folder["id"] | Page["id"], pages: Pages) => {
return paths.reverse().join("/").replace(/\/+/g, "/");
};

export const getStaticSiteMapXml = (pages: Page[], updatedAt: string) => {
export const getStaticSiteMapXml = (pages: Pages, updatedAt: string) => {
const allPages = [pages.homePage, ...pages.pages];
return (
pages
allPages
// ignore pages with excludePageFromSearch bound to variables
// because there is no data from cms available at build time
.filter(
(page) => executeExpression(page.meta.excludePageFromSearch) !== true
)
.map((page) => ({
path: page.path,
path: getPagePath(page.id, pages),
lastModified: updatedAt.split("T")[0],
}))
);
Expand Down

0 comments on commit df0e203

Please sign in to comment.