🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

v_sitemap

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

v_sitemap

Simple XML Sitemap Generator. Uses array of links and provides sitemapindex and urlset.

latest
Source
npmnpm
Version
0.0.2
Version published
Maintainers
1
Created
Source

v_sitemap

[🔥] WARNING : ALPHA DEVELOPMENT STATE [🔥]

00. Output Examples [from same array of items]:

v_sitemap Output Examples

1. Installing:

npm i v_sitemap --save

2. Using:

const v_sitemap = require('.');

// Some Random Array to Use for demonstration purpose.
const DEMO_DATA = [
    {
        name: 'Home',
        path: '/',
        lastmod: '2019-01-01',
        changefreq: 'yearly',
        priority: 0.4,
    },
    {
        name: 'About',
        path: '/about', 
        lastmod: '2020-01-01',
        changefreq: 'monthly',
        priority: 0.6,
    },{
        name: 'Contact',
        path: '/contact',
        lastmod: '2021-01-01',
        changefreq: 'daily',
        priority: 0.9,
    } 
];

const myMap = {
    data: DEMO_DATA, 
    index: true, 
    output: "DEMO_DATA.xml"
    };

v_sitemap(myMap);

2.1. Listing of sitemaps [sitemapindex]

That code will the produce this XML file:

<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    <sitemap>
        <loc>https://v-core9.com/</loc>
    </sitemap>
    <sitemap>
        <loc>https://v-core9.com/about</loc>
    </sitemap>
    <sitemap>
        <loc>https://v-core9.com/contact</loc>
    </sitemap>
</sitemapindex>

2.2. Single Sitemap [urlset]

By Changing option in "myMap" constant from "index == true" to false...like this:

const myMap = {
    data: DEMO_DATA, 
    index: false, 
    output: "DEMO_DATA.SMAP.xml"
};

v_sitemap(myMap);

and instead of sitemapindex it will produce this XML file

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    <url>
        <loc>https://v-core9.com/</loc>
        <lastmod>2019-01-01</lastmod>
        <changefreq>yearly</changefreq>
        <priority>0.4</priority>
    </url>
    <url>
        <loc>https://v-core9.com/about</loc>
        <lastmod>2020-01-01</lastmod>
        <changefreq>monthly</changefreq>
        <priority>0.6</priority>
    </url>
    <url>
        <loc>https://v-core9.com/contact</loc>
        <lastmod>2021-01-01</lastmod>
        <changefreq>daily</changefreq>
        <priority>0.9</priority>
    </url>
</urlset>

2.3. Styled sitemap

By adding additional entry that is URL path to the file:

const myStyledMap = {
    data: DEMO_DATA,
    index: true,
    output: "sample.myStyledMap.xml",
    stylesheet:  "v-core9.com/style/XSL/sitemap.xsl"
};

v_sitemap(myStyledMap);

Sitemap Generation Options?

NOTICE:

For now just check _TEST_ Directory & "sample.run.js" file for more info

Keywords

v_sitemap

FAQs

Package last updated on 05 Jan 2022

Did you know?

Socket

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.

Install

Related posts