Skip to content

Commit e14c3f3

Browse files
committed
fix(rel): fix bug causes by sitemap.txt
1 parent 59f60d2 commit e14c3f3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/rel.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ function relSitemapInject(data) {
77

88
if (!rel || data.match(/rel=['|"]?sitemap['|"]?/i)) return;
99

10-
const relSitemap = `<link rel="sitemap" type="application/xml" title="Sitemap" href="${url_for.call(this, path)}">`;
10+
const relPath = typeof path === 'string' ? path : path[0];
11+
const relSitemap = `<link rel="sitemap" type="application/xml" title="Sitemap" href="${url_for.call(this, relPath)}">`;
1112

1213
return data.replace(/<head>(?!<\/head>).+?<\/head>/s, str => str.replace('</head>', `${relSitemap}</head>`));
1314
}

0 commit comments

Comments
 (0)