0.2.1 • Published 9 months ago

@stdian/react-sitemap v0.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

React Sitemap

Module for generating sitemaps using React nodes. Also, it can export your sitemap to XML.

Installation

Install through NPM

npm install @stdian/react-sitemap

or

git clone git://github.com/stdian/react-sitemap.git

Usage

import Sitemap from "@stdian/react-sitemap";

const host = "https://stdian.ru";

const routes = [
	{
		url: "/",
		priority: 1,
		lastmod: "2024-12-01",
		changefreq: "always",
	},
	{
		url: "/page1",
		priority: 0.8,
		lastmod: "2024-12-01",
		changefreq: "monthly",
		images: ["https://stdian.ru/image1.jpg"],
	},
	{
		url: "/page2",
		priority: 1,
		images: ["https://stdian.ru/image2.jpg", "https://stdian.ru/image3.jpg"],
	},
];

const sitemap = new Sitemap(host, routes);

// get React node

sitemap.getReactNode();

// get XML

sitemap.getXml();

Route options

  • urlString page route
  • priorityInteger route priority from 0 to 1
  • changefreqString How frequently the page is likely to change.
    • Valid values are:
      • always
      • hourly
      • daily
      • weekly
      • monthly
      • yearly
      • never
  • lastmodString The date of last modification of the page. Format: YYYY-MM-DD
  • imageString[] Array of image urls
0.2.1

9 months ago

0.2.0

9 months ago

0.1.1

2 years ago