Skip to content

feat: give finer control over trailing slash handling #477

@sebmahe

Description

@sebmahe

🆒 Your use case

In the context of an ecommerce website, I'm using trailing slashes for category pages (ex: notebooks) and no trailing slashes for product pages (ex: macbook-air).

At this time, this configuration is not possible with @nuxtjs/sitemap. The configuration option trailingSlash is only set site-wide.

🆕 The solution you'd like

I'm using a multi-sitemap configuration. I'm wondering if the trailingSlash option can be moved at the sitemap level ?

export default defineNuxtConfig(
	sitemap: {
		sitemaps: {
			categories: {
				sources: [ '/api/sitemaps/categories' ],
				trailingSlash: true
			},
			products: {
				sources: [ '/api/sitemaps/products' ]
				trailingSlash: false
			},
		},
	},
)

🔍 Alternatives you've considered

In my context, sitemaps are generated with dynamic sources like illustrated in the config sample above. Each endpoint output locations with the wanted trailing slash or without trailing slash.

If the locations can be left untouched : my problem would also be solved.

ℹ️ Additional info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions