Socket
Socket
Sign inDemoInstall

@astrojs/sitemap

Package Overview
Dependencies
Maintainers
3
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@astrojs/sitemap

Generate a sitemap for your Astro site


Version published
Weekly downloads
118K
increased by4.62%
Maintainers
3
Weekly downloads
 
Created

What is @astrojs/sitemap?

@astrojs/sitemap is an npm package designed to generate sitemaps for Astro projects. It helps in creating XML sitemaps that are essential for SEO, allowing search engines to crawl and index your website more effectively.

What are @astrojs/sitemap's main functionalities?

Basic Sitemap Generation

This feature allows you to generate a basic sitemap for your Astro project. By specifying the site URL and integrating the sitemap plugin, you can automatically create a sitemap.xml file.

import { defineConfig } from 'astro/config';
import sitemap from '@astrojs/sitemap';

export default defineConfig({
  site: 'https://example.com',
  integrations: [sitemap()]
});

Customizing Sitemap Options

This feature allows you to customize various options for your sitemap, such as change frequency, priority, excluding specific pages, and adding custom pages.

import { defineConfig } from 'astro/config';
import sitemap from '@astrojs/sitemap';

export default defineConfig({
  site: 'https://example.com',
  integrations: [
    sitemap({
      changefreq: 'daily',
      priority: 0.8,
      exclude: ['/exclude-this-page'],
      customPages: ['/custom-page-1', '/custom-page-2']
    })
  ]
});

Dynamic Sitemap Generation

This feature allows for dynamic generation of the sitemap by filtering and serializing pages. You can exclude certain pages and customize the sitemap entries dynamically.

import { defineConfig } from 'astro/config';
import sitemap from '@astrojs/sitemap';

export default defineConfig({
  site: 'https://example.com',
  integrations: [
    sitemap({
      filter: (page) => !page.includes('/exclude-this-page'),
      serialize: (page) => ({
        url: page,
        lastmod: new Date().toISOString(),
        changefreq: 'weekly',
        priority: 0.5
      })
    })
  ]
});

Other packages similar to @astrojs/sitemap

Keywords

FAQs

Package last updated on 18 Apr 2024

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

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