Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@mongez/sitemap
Advanced tools
Readme
A simple yet powerful sitemap generator written for Node.js.
Yarn
yarn add @mongez/sitemap
NPM
npm i @mongez/sitemap
PNPM
pnpm i @mongez/sitemap
BUN
bun add @mongez/sitemap
Import the sitemap class, pass the base url and locale codes to it, then add the pages to the sitemap.
import { Sitemap } from "@mongez/sitemap";
const sitemap = new Sitemap("https://example.com", ["en", "ar"]);
sitemap.add("/").add("/about-us").add("/contact-us");
await sitemap.saveTo("/path/to/sitemap.xml");
And that's it
This will create a sitemap with links, each link will have the original path along with the locale code as well.
If you want to customize the path, you can pass an object to the add
method.
sitemap.add({
path: "/",
lastModified: new Date(),
changeFrequency: "daily",
priority: 0.8,
});
The object can have the following properties:
type SitemapPath = {
/**
* The relative path to the website
*/
path: string;
/**
* Last modification date
*/
lastModified?: Date | string;
/**
* Change frequency
*/
changeFrequency?: string;
/**
* Priority
*/
priority?: number;
/**
* Hreflang
* If you have multiple languages, you can add the hreflang, it will be used automatically if locale codes are set
*/
hreflang?: {
[localeCOde: string]: string;
};
};
If you want just the xml sitemap without saving it to a file, you can use the generate
method.
const xml = await sitemap.generate();
Alternatively, you can use the toXml
method.
const xml = await sitemap.toXml();
FAQs
A simple Sitemap generator for Node.js
The npm package @mongez/sitemap receives a total of 2 weekly downloads. As such, @mongez/sitemap popularity was classified as not popular.
We found that @mongez/sitemap demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.