@cheers-io/nuxt-storyblok-sitemap
v1.4.0
Published
Generates a sitemap for content provided by Storyblok
Downloads
153
Readme
Nuxt Storyblok sitemap
Generates a sitemap for content provided by Storyblok
Features
- Dynamic sitemap generation
- Per page filtering
- Multilingual support
Quick Setup
- Add
@cheers-io/nuxt-storyblok-sitemap
dependency to your project
# Using npm
npm install @cheers-io/nuxt-storyblok-sitemap
# Using pnpm
pnpm add @cheers-io/nuxt-storyblok-sitemap
# Using yarn
yarn add @cheers-io/nuxt-storyblok-sitemap
- Add
@cheers-io/nuxt-storyblok-sitemap
to themodules
section ofnuxt.config.ts
. Сonfiguration object can be passed in one of the following ways
export default defineNuxtConfig({
modules: ["@cheers-io/nuxt-storyblok-sitemap"],
storyblokSitemap: {
// config object
},
});
or
export default defineNuxtConfig({
modules: [
"@cheers-io/nuxt-storyblok-sitemap",
{
// config object
},
],
});
- Configuration object interface
{
// accessToken for Storyblok API
// required
accessToken: string;
// base URL to be used for the sitemap generation
// required
baseUrl: string;
// default locale to be used for the stories with default language
// - if not provided, the sitemap will only contain entries for default Storyblok language
// - if provided, the sitemap will contain entries for all Storyblok languages (if any)
// optional, default ""
defaultLocale: string;
// can be used to filter out stories by full_slug via RegExp
// optional, default []
blacklist: string[];
// Storyblok API url
// optional, default "https://api.storyblok.com/v2/cdn/stories"
apiUrl: string;
// path to the sitemap file, relative to the website domain
// optional, default "sitemap.xml"
uri: string;
}
That's it! You can now use Nuxt Storyblok sitemap in your Nuxt app ✨
Blacklist details
There is a chance you want to hide some pages from the generated sitemap. For example, you don't want to include stories that start with global/*
. Or you want to hide any story which slug includes hidden
part. Or maybe you don't want to see stories which end with /private
word.
In this case your config might look like this:
{
blacklist: ["^global/", "hidden", "/private$"];
}
Development
# Install dependencies
npm install
# Generate type stubs
npm run dev:prepare
# Develop with the playground
npm run dev
# Build the playground
npm run dev:build
# Run ESLint
npm run lint
# Run Vitest
npm run test
npm run test:watch
# Release new version
npm run release
Contact
Follow us on Twitter, LinkedIn or visit our website. You can also write us an email.
License
This project is licensed under the MIT license. For more information see the LICENSE file.
Copyright 2023 - cheers digital solutions GmbH