New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

sitemapy

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sitemapy - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

2

package.json
{
"name": "sitemapy",
"version": "1.3.0",
"version": "1.4.0",
"description": "Simple utility to generate sitemaps in xml, with zero dependencies",

@@ -5,0 +5,0 @@ "main": "dist/sitemapy.js",

@@ -5,2 +5,72 @@ # Sitemapy

Simple utility to generate sitemaps
Simple utility to generate sitemaps
## 👀 How to use ?
```sh
npm i sitemapy
```
```js
import {createSitemap} from "sitemapy"
const siteRoot = "https://github.com"
let pages = [
{
url: "/about", //all optional except url
priority: 1,
changefreq: "daily",
lastmod: 10-04-22
}
]
const sitemap = createSitemap({pages, siteRoot}) //returns string of sitemap XML
```
## Typescript
```js
import {createSitemap} from "sitemapy"
import type {SitemapElement, SitemapConfig} from "sitemapy"
const siteRoot = "https://github.com"
let pages: Array<SitemapElement> = [
{
url: "/about", //all optional except url
priority: 1,
changefreq: "daily",
lastmod: 10-04-22
}
]
const config: SitemapConfig = {pages, siteRoot}
const sitemap = createSitemap(config) //returns string of sitemap XML
```
## Examples
With express
```js
import axios from "axios"
import {createSitemap} from "sitemapy"
app.get("/sitemap.xml", async (req, res) => {
const siteRoot = "https://github.com"
const {data} = await axios.get("/api/sitemapData")
const sitemap = createSitemap({pages: data, siteRoot})
res.setHeader('Content-Type', 'application/xml')
res.send(sitemap)
})
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc