File tree Expand file tree Collapse file tree 2 files changed +8
-9
lines changed
packages/integrations/sitemap Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -98,8 +98,7 @@ const createPlugin = (options?: SitemapOptions): AstroIntegration => {
98
98
. map ( ( p ) => {
99
99
if ( p . pathname !== '' && ! finalSiteUrl . pathname . endsWith ( '/' ) )
100
100
finalSiteUrl . pathname += '/' ;
101
- if ( p . pathname . startsWith ( '/' ) )
102
- p . pathname = p . pathname . slice ( 1 ) ;
101
+ if ( p . pathname . startsWith ( '/' ) ) p . pathname = p . pathname . slice ( 1 ) ;
103
102
const fullPath = finalSiteUrl . pathname + p . pathname ;
104
103
return new URL ( fullPath , finalSiteUrl ) . href ;
105
104
} ) ;
Original file line number Diff line number Diff line change 1
- import { before , describe , it } from " node:test" ;
2
- import { loadFixture , readXML } from " ./test-utils.js" ;
3
- import assert from " node:assert/strict" ;
1
+ import { before , describe , it } from ' node:test' ;
2
+ import { loadFixture , readXML } from ' ./test-utils.js' ;
3
+ import assert from ' node:assert/strict' ;
4
4
5
5
describe ( 'Dynamic with rest parameter' , ( ) => {
6
6
/** @type {import('./test-utils.js').Fixture } */
7
7
let fixture ;
8
-
8
+
9
9
before ( async ( ) => {
10
10
fixture = await loadFixture ( {
11
11
root : './fixtures/dynamic' ,
12
12
} ) ;
13
13
await fixture . build ( ) ;
14
14
} ) ;
15
-
15
+
16
16
it ( 'Should generate correct urls' , async ( ) => {
17
17
const data = await readXML ( fixture . readFile ( '/sitemap-0.xml' ) ) ;
18
18
const urls = data . urlset . url . map ( ( url ) => url . loc [ 0 ] ) ;
19
-
19
+
20
20
assert . ok ( urls . includes ( 'http://example.com/' ) ) ;
21
21
assert . ok ( urls . includes ( 'http://example.com/blog/' ) ) ;
22
22
assert . ok ( urls . includes ( 'http://example.com/test/' ) ) ;
23
23
} ) ;
24
- } )
24
+ } ) ;
You can’t perform that action at this time.
0 commit comments