Skip to content

Commit

Permalink
fix: sitemap: permalink with helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
kiuKisas committed May 10, 2021
1 parent acf4c37 commit 48c3584
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/sitemap/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const plugin = {
name: 'addAllRequestsToPlugin',
description: 'Generates a sitemap on build.',
priority: 1, // we want it to be last.
run: async ({ allRequests, plugin, settings, routes, query }) => {
run: async ({ allRequests, plugin, helpers, settings, routes, query }) => {
if (settings.build && !settings.worker) {
if (plugin.internal.ready) {
const customPriority =
Expand Down Expand Up @@ -129,7 +129,7 @@ const plugin = {
includedRequests[indexFileName] = [];

routeRequests.forEach((request) => {
const permalink = routes[route].permalink({ request, settings });
const permalink = routes[route].permalink({helpers, request, settings });

const exclude = plugin.config.exclude.find(
(e) => permalink.startsWith(`/${e}`) || permalink.startsWith(`${e}`),
Expand All @@ -148,7 +148,7 @@ const plugin = {

let xml = SITEMAP_HEADER;
routeRequests.forEach((request) => {
const permalink = routes[request.route].permalink({ request, settings });
const permalink = routes[request.route].permalink({helpers, request, settings });

xml += `<url><loc>${plugin.config.origin}${permalink.replace(/&/g, '&amp;')}</loc><lastmod>${formatDate(
request.lastUpdate,
Expand Down

0 comments on commit 48c3584

Please sign in to comment.