Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

strapi-plugin-sitemap

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

strapi-plugin-sitemap

A plugin for Strapi to create a customizable sitemap.

  • 1.1.0
  • npm
  • Socket score

Version published
Weekly downloads
2.9K
decreased by-1.11%
Maintainers
1
Weekly downloads
 
Created
Source

Strapi Plugin Sitemap

Every public website should have a sitemap.xml to increase SEO. A website where the content is managed by Strapi should be no different. With this plugin you can generate a sitemap server side, which allows you to customize it based on your data structure in Strapi.

This plugin uses the UID field type to fetch URLs, and therefor expects a Strapi version of 3.0.0-beta.19.3 or higher.

Installation

Use npm or yarn to install and build the plugin.

yarn add strapi-plugin-sitemap
yarn build
yarn develop

Configuration

Before you can generate the sitemap you need to specify what you want to be in it. In the admin section of the plugin you can add 'Collection entries' and 'Custom entries' to the sitemap. With collection entries you can add all URLs of a collection or single type, with custom entries you can add URLs which are not managed by Strapi. Also make sure to set the hostname of your website.

After saving the settings and generating the sitemap, it will be written in the /public folder of your Strapi project, making it available at http://localhost:1337/sitemap.xml.

Setup Strapi sitemap

  1. Add the sitemap.xml to the .gitignore of your project.

  2. As of writing this the Strapi lifecycle methods are not stable and can't be used to regenerate the sitemap after a change of a URL. So to make sure your sitemap is up-to-date you can add a cron job where you run the createSitemap() service periodically.

Cron job

// Generate the sitemap every 12 hours
'0 */12 * * *': () => {
    strapi.plugins.sitemap.services.sitemap.createSitemap();
},

Resources

⭐️ Show your support

Give a star if this project helped you.

FAQs

Package last updated on 21 Mar 2020

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