-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
408be72
commit dff0d0d
Showing
4 changed files
with
54 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@astrojs/sitemap': patch | ||
--- | ||
|
||
Fix sitemap does not filter pages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { loadFixture, readXML } from './test-utils.js'; | ||
import { expect } from 'chai'; | ||
import { sitemap } from './fixtures/static/deps.mjs'; | ||
|
||
describe('Filter support', () => { | ||
/** @type {import('./test-utils.js').Fixture} */ | ||
let fixture; | ||
|
||
describe('Static', () => { | ||
before(async () => { | ||
fixture = await loadFixture({ | ||
root: './fixtures/static/', | ||
integrations: [sitemap({ | ||
filter: (page) => page !== 'http://example.com/two/' | ||
})], | ||
}); | ||
await fixture.build(); | ||
}); | ||
|
||
it('Just one page is added', async () => { | ||
const data = await readXML(fixture.readFile('/sitemap-0.xml')); | ||
const urls = data.urlset.url; | ||
expect(urls.length).to.equal(1); | ||
}); | ||
}); | ||
|
||
describe('SSR', () => { | ||
before(async () => { | ||
fixture = await loadFixture({ | ||
root: './fixtures/ssr/', | ||
integrations: [sitemap({ | ||
filter: (page) => page !== 'http://example.com/two/' | ||
})], | ||
}); | ||
await fixture.build(); | ||
}); | ||
|
||
it('Just one page is added', async () => { | ||
const data = await readXML(fixture.readFile('/client/sitemap-0.xml')); | ||
const urls = data.urlset.url; | ||
expect(urls.length).to.equal(1); | ||
}); | ||
}); | ||
|
||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as sitemap } from '@astrojs/sitemap'; |