🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@astrojs/sitemap

Package Overview
Dependencies
Maintainers
3
Versions
69
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

3.4.0
latest
Source
npm
Version published
Weekly downloads
197K
0.48%
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

astro-integration

FAQs

Package last updated on 12 May 2025

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