Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ykzts/edge-sitemap
Generator of Sitemaps using web standard technology for operation in Edge Computing.
https://github.com/ykzts/edge-sitemap
edge sitemap
Last synced: 3 days ago
JSON representation
Generator of Sitemaps using web standard technology for operation in Edge Computing.
- Host: GitHub
- URL: https://github.com/ykzts/edge-sitemap
- Owner: ykzts
- License: mit
- Created: 2023-02-23T13:51:48.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-17T09:25:17.000Z (almost 2 years ago)
- Last Synced: 2024-05-16T17:45:08.583Z (7 months ago)
- Topics: edge, sitemap
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/edge-sitemap
- Size: 239 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Edge Sitemap
Generator of Sitemaps using web standard technology for operation in Edge Computing.
## Usage
```javascript
import { SitemapStream } from 'edge-sitemap'function createReadableStream() {
return new ReadableStream({
start(controller) {
controller.enqueue({
loc: '/',
priority: 1.0,
})
controller.enqueue({
loc: '/privacy',
priority: 0.1,
})
controller.close()
},
})
}addEventListener('fetch', (event) => {
const baseURL = 'https://example.com/'
const body = createReadableStream()
.pipeThrough(new SitemapStream({ baseURL }))
.pipeThrough(new TextEncoderStream())
const response = new Response(body, {
headers: {
'Content-Type': 'application/xml; charset=UTF-8',
},
})return event.respondWith(response)
})
```