All Projects → boazpoolman → strapi-plugin-sitemap

boazpoolman / strapi-plugin-sitemap

Licence: MIT License
🔌 Generate a highly customizable sitemap XML in Strapi CMS

Programming Languages

javascript
184084 projects - #8 most used programming language
XSLT
1337 projects
CSS
56736 projects

Projects that are alternatives of or similar to strapi-plugin-sitemap

Sitemap Generator Cli
Creates an XML-Sitemap by crawling a given site.
Stars: ✭ 214 (+57.35%)
Mutual labels:  sitemap, seo
strapi-plugin-import-export-content
Csv and Json import / export content plugin to Strapi
Stars: ✭ 129 (-5.15%)
Mutual labels:  strapi, strapi-plugin
strapi-plugin-github-publish
This is a plugin for Strapi headless CMS. It lets you trigger a GitHub Action workflow when the site is ready to be published.
Stars: ✭ 35 (-74.26%)
Mutual labels:  strapi, strapi-plugin
strapi-plugin-sync-roles-permissions
Store user roles and permissions configuration as a JSON file and then import and reuse it any time.
Stars: ✭ 34 (-75%)
Mutual labels:  strapi, strapi-plugin
sitemap-checker
a tool for validate xml sitemap and sitemap index files for broken links
Stars: ✭ 21 (-84.56%)
Mutual labels:  sitemap, seo
Sitemap Generator Crawler
Script that generates a sitemap by crawling a given URL
Stars: ✭ 169 (+24.26%)
Mutual labels:  sitemap, seo
classicpress-seo
Classic SEO is the first SEO plugin built specifically to work with ClassicPress. A fork of Rank Math, the plugin contains many essential SEO tools to help optimize your website.
Stars: ✭ 18 (-86.76%)
Mutual labels:  sitemap, seo
Laravel Sitemap
Create and generate sitemaps with ease
Stars: ✭ 1,325 (+874.26%)
Mutual labels:  sitemap, seo
strapi-plugin-zeasy-image-api
Strapi plugin to ease the process importing Unsplash image with attribution
Stars: ✭ 28 (-79.41%)
Mutual labels:  strapi, strapi-plugin
siteshooter
📷 Automate full website screenshots and PDF generation with multiple viewport support.
Stars: ✭ 63 (-53.68%)
Mutual labels:  sitemap, seo
Craft Seomatic
SEOmatic facilitates modern SEO best practices & implementation for Craft CMS 3. It is a turnkey SEO system that is comprehensive, powerful, and flexible.
Stars: ✭ 135 (-0.74%)
Mutual labels:  sitemap, seo
sitemap
A simple sitemap generator for Laravel Framework.
Stars: ✭ 32 (-76.47%)
Mutual labels:  sitemap, seo
Craft Sitemap
Craft plugin to generate a sitemap.
Stars: ✭ 105 (-22.79%)
Mutual labels:  sitemap, seo
Seo
SEO utilities including a unique field type, sitemap & redirect manager
Stars: ✭ 210 (+54.41%)
Mutual labels:  sitemap, seo
Laravel Seo Tools
Laravel Seo package for Content writer/admin/web master who do not know programming but want to edit/update SEO tags from dashboard
Stars: ✭ 99 (-27.21%)
Mutual labels:  sitemap, seo
vuepress-plugin-sitemap
Sitemap generator plugin for vuepress.
Stars: ✭ 92 (-32.35%)
Mutual labels:  sitemap, seo
Dctb Links
My Personal Links
Stars: ✭ 65 (-52.21%)
Mutual labels:  sitemap, seo
Gatsby Advanced Starter
A high performance skeleton starter for GatsbyJS that focuses on SEO/Social features/development environment.
Stars: ✭ 1,224 (+800%)
Mutual labels:  sitemap, seo
Silverstripe-SEO
A SilverStripe module to optimise the Meta, crawling, indexing, and sharing of your website content
Stars: ✭ 41 (-69.85%)
Mutual labels:  sitemap, seo
strapi-plugin-vercel
▲ Strapi plugin for Vercel Platform
Stars: ✭ 28 (-79.41%)
Mutual labels:  strapi, strapi-plugin

Strapi sitemap plugin

Create a highly customizable sitemap XML in Strapi CMS.

NPM Version Monthly download on NPM CI build status codecov.io

Features

  • Multilingual (Implements rel="alternate" with @strapi/plugin-i18n)
  • Auto-updating (Uses lifecycle methods to keep the sitemap XML up-to-date)
  • URL bundles (Bundle URLs by type and add them to the sitemap XML)
  • Dynamic paths (Implements URL patterns in which you can inject dynamic fields)
  • Exclude URLs (Exclude specified URLs from the sitemap)
  • Custom URLs (URLs of pages which are not managed in Strapi)
  • Styled with XSL (Human readable XML styling)

Installation

Install the plugin in your Strapi project.

# using yarn
yarn add strapi-plugin-sitemap

# using npm
npm install strapi-plugin-sitemap --save

After successful installation you have to rebuild the admin UI so it'll include this plugin. To rebuild and restart Strapi run:

# using yarn
yarn build
yarn develop

# using npm
npm run build
npm run develop

The Sitemap plugin should appear in the Plugins section of Strapi sidebar after you run app again.

Enjoy 🎉

🖐 Requirements

Complete installation requirements are the exact same as for Strapi itself and can be found in the Strapi documentation.

Supported Strapi versions:

  • Strapi 4.0.3 (recently tested)
  • Strapi ^4.x (use strapi-plugin-sitemap@^2.0.0)
  • Strapi ^3.4.x (use [email protected])

(This plugin may work with older Strapi versions, but these are not tested nor officially supported at this time.)

We recommend always using the latest version of Strapi to start your new projects.

💡 Usage

With this plugin you have full control over which URLs you add to your sitemap XML. Go to the admin section of the plugin and start adding URLs. Here you will find that there are two ways to add URLs to the sitemap. With URL bundles and Custom URLs.

URL bundles

A URL bundle is a set of URLs grouped by type. When adding a URL bundle to the sitemap you can define a URL pattern which will be used to generate all URLs in this bundle. (Read more about URL patterns below)

URLs coming from a URL bundle will get the following XML attributes:

  • <loc>
  • <lastmod>
  • <priority>
  • <changefreq>

Custom URLs

A custom URL is meant to add URLs to the sitemap which are not managed in Strapi. It might be that you have custom route like /account that is hardcoded in your front-end. If you'd want to add such a route (URL) to the sitemap you can add it as a custom URL.

Custom URLs will get the following XML attributes:

  • <loc>
  • <priority>
  • <changefreq>

🔌 URL pattern

To create dynamic URLs this plugin uses URL patterns. A URL pattern is used when adding URL bundles to the sitemap and has the following format:

/pages/[my-uid-field]

Fields can be injected in the pattern by escaping them with [].

The following field types are by default allowed in a pattern:

  • id
  • uid

Allowed field types can be altered with the allowedFields config. Read more about it below.

🌍 Multilingual

When adding a URL bundle of a type which has localizations enabled you will be presented with a language dropdown in the settings form. You can now set a different URL pattern for each language.

For each localization of a page the <url> in the sitemap XML will get an extra attribute:

  • <xhtml:link rel="alternate">

This implementation is based on Google's guidelines on localized sitemaps.

🤖 Robots.txt

To make sure search engines are able to find the sitemap XML create a robots.txt file in the front-end of your website and add the following line:

Sitemap: https://your-strapi-domain.com/sitemap/index.xml

Read more about the robots.txt file here.

⚙️ Settings

Settings can be changed in the admin section of the plugin. In the last tab (Settings) you will find the settings as described below.

Hostname (required)

The hostname is the URL of your website. It will be used as the base URL of all URLs added to the sitemap XML. It is required to generate the XML file.

Key: hostname

required: YES | type: string | default: ''

Hostname overrides

If you are using this plugin in a multilingual Strapi project you will be presented with a 'Hostname overrides' setting. With this setting you can set a specific hostname per language.

This is handy for when you have a URL structure like this:

Key: hostname_overrides

required: NO | type: object | default: {}

Exclude drafts

When using the draft/publish functionality in Strapi this setting will make sure that all draft pages are excluded from the sitemap. If you want to have the draft pages in the sitemap anyways you can disable this setting.

Key: excludeDrafts

required: NO | type: bool | default: true

Include homepage

This setting will add a default / entry to the sitemap XML when none is present. The / entry corresponds to the homepage of your website.

Key: includeHomepage

required: NO | type: bool | default: true

🔧 Config

Config can be changed in the config/plugins.js file in your Strapi project. You can overwrite the config like so:

module.exports = ({ env }) => ({
  // ...
  'sitemap': {
    enabled: true,
    config: {
      autoGenerate: true,
      allowedFields: ['id', 'uid'],
      excludedTypes: [],
    },
  },
});

Auto generate

When adding URL bundles to your sitemap XML, and auto generate is set to true, the plugin will utilize the lifecycle methods to regenerate the sitemap on create, update and delete for pages of the URL bundles type. This way your sitemap will always be up-to-date when making content changes.

You might want to disable this setting if you're experiencing performance issues. You could alternatively create a cronjob in which you generate the sitemap XML periodically. Like so:

// Generate the sitemap every 12 hours
'0 */12 * * *': () => {
  strapi.plugin('sitemap').service('core').createSitemap();
},
Key: autoGenerate

required: NO | type: bool | default: true

Allowed fields

When defining a URL pattern you can populate it with dynamic fields. The fields allowed in the pattern are specified by type. By default only the field types id and uid are allowed in the pattern, but you can alter this setting to allow more field types in the pattern.

If you are missing a key field type of which you think it should be allowed by default please create an issue and explain why it is needed.

Key: allowedFields

required: NO | type: array | default: ['id', 'uid']

Excluded types

This setting is just here for mere convenience. When adding a URL bundle to the sitemap you can specify the type for the bundle. This will show all types in Strapi, however some types should never be it's own page in a website and are therefor excluded in this setting.

All types in this array will not be shown as an option when selecting the type of a URL bundle.

Key: excludedTypes

required: NO | type: array | default: ['admin::permission', 'admin::role', 'admin::api-token', 'plugin::i18n.locale', 'plugin::users-permissions.permission', 'plugin::users-permissions.role']

🤝 Contributing

Feel free to fork and make a pull request of this plugin. All the input is welcome!

⭐️ Show your support

Give a star if this project helped you.

🔗 Links

🌎 Community support

📝 Resources

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].