Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(bodiless-next): Fixing EmptySitemap error in @sites/--minimal-nex… #2079

Merged
merged 1 commit into from
May 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ node_modules

# Temporary files
.DS_Store
.swp
*.swp
*.swo
.eslintcache
*.tsbuildinfo
# jetbrains files:
Expand Down
3 changes: 2 additions & 1 deletion packages/bodiless-next/src/Webpack/Sitemapxml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const generateSitemapXml = async (options: Partial<SitemapxmlConfig> | undefined
if (!siteUrl) return;

const pages = await getPages();
if (!pages.length) return;

const mergedOptions = {
...bodilessNextConfigPath.sitemapxml,
Expand All @@ -68,7 +69,7 @@ const generateSitemapXml = async (options: Partial<SitemapxmlConfig> | undefined
)
)) : pages;

const serializedPages = filteredPages.filter(Boolean).map((page: string) => serialize(
const serializedPages = filteredPages.map((page: string) => serialize(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

filter might not be necessary since the pages type is string[]

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and empty string is a valid page item.

new URL(page, siteUrl).pathname
));

Expand Down